forked from vmware-archive/concourse-pipeline-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package-docker-images.yml
53 lines (51 loc) · 1.42 KB
/
package-docker-images.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
resources:
- name: ubuntu-image-to-package
type: docker-image
source:
repository: ubuntu # UPDATE THIS with the targeted image repo name
tag: 17.04 # UPDATE THIS with the desired tag of the image
- name: my-ubuntu-image-s3
type: s3
source:
access_key_id: ((s3-access-key-id))
bucket: ((s3-bucket))
endpoint: ((s3-endpoint))
secret_access_key: ((s3-secret-access-key))
regexp: ubuntu/ubuntu-(.*).tgz
jobs:
- name: Download-And-Package-Ubuntu-Image
plan:
- get: ubuntu-image-to-package
params:
rootfs: true
- task: prepare-image-to-export
config:
platform: linux
inputs:
- name: ubuntu-image-to-package
outputs:
- name: ubuntu
image_resource:
type: docker-image
source:
repository: ubuntu
run:
path: sh
args:
- -exc
- |
echo "Exporting ubuntu image"
mkdir export-directory && cd export-directory
cp ../ubuntu-image-to-package/metadata.json .
mkdir rootfs
tar -xvf ../ubuntu-image-to-package/rootfs.tar -C ./rootfs/ --exclude="dev/*"
cd rootfs
cd ../..
echo "Packaging ubuntu image"
tmp_version="17.04"
tar -czf "ubuntu/ubuntu-${tmp_version}.tgz" -C export-directory .
ls -la ubuntu
- put: my-ubuntu-image-s3
params:
file: "ubuntu/ubuntu-*.tgz"