From b9d9b1b04944ca0546b653fbd6b1b892c93ed77f Mon Sep 17 00:00:00 2001 From: Petu Eusebiu Date: Mon, 20 Nov 2023 13:01:21 +0200 Subject: [PATCH] ci: add publish squashfs layers Signed-off-by: Petu Eusebiu --- .github/workflows/ci.yaml | 32 ++++++++++++++++++++++++++++++++ action.yml | 4 ++-- src/index.ts | 1 - test/builds/first/stacker.yaml | 6 +++--- test/builds/second/stacker.yaml | 8 ++++---- test/builds/third/stacker.yaml | 8 ++++---- 6 files changed, 45 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 18e74b1..5258a6d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -98,3 +98,35 @@ jobs: url: docker://localhost:5000/five/app layer-type: 'tar squashfs' skip-tls: true + + - name: Run stacker-build with push, tags, build-args and layer-type(squashfs) + uses: ./ + with: + file: 'test/stacker.yaml' + build-args: | + SUB1=VAR1 + SUB2=VAR2 + SUB3=VAR3 + tags: v1 latest + url: docker://localhost:5000/six/app + layer-type: 'squashfs' + skip-tls: true + + - name: Check images were published + run: | + docker pull localhost:5000/one/app/test:v1 + docker pull localhost:5000/one/app/test + docker pull localhost:5000/two/app/test:v1 + docker pull localhost:5000/two/app/test + docker pull localhost:5000/three/app/test:v1 + docker pull localhost:5000/three/app/test + docker pull localhost:5000/four/app/app:v1 + docker pull localhost:5000/four/app/app + docker pull localhost:5000/six/app/test:v1-squashfs + docker pull localhost:5000/six/app/test:latest-squashfs + + docker pull localhost:5000/five/app/layer3_1:v2 + docker pull localhost:5000/five/app/layer3_2:v2-squashfs + + docker pull localhost:5000/five/app/layer3_1:v2 + docker pull localhost:5000/five/app/layer3_2:v2-squashfs diff --git a/action.yml b/action.yml index 82ccc64..784f12d 100644 --- a/action.yml +++ b/action.yml @@ -25,7 +25,7 @@ inputs: file-pattern: description: 'regex pattern to use when searching for stackerfile paths, used with dir arg' required: false - default: '\\/stacker.yaml$' + default: 'stacker.yaml' layer-type: description: 'Set the output layer type (supported values: tar, squashfs) separated by whitespace' required: false @@ -41,7 +41,7 @@ inputs: description: 'Tags used when pushing to remote OCI registry, separated by whitespace' required: false url: - description: 'Remote registry URL, eg: docker://ghcr.io/myRepo' + description: 'Remote registry URL, eg: docker://ghcr.io/myrepo' required: false username: description: 'Username for the remote registry' diff --git a/src/index.ts b/src/index.ts index 23d7cff..af72663 100644 --- a/src/index.ts +++ b/src/index.ts @@ -61,7 +61,6 @@ export async function run(): Promise { // get layer-type from input const layerTypes = utils.getSpaceSeparatedInput("layer-type"); - core.info(`dockerfile val: ${dockerfile}`); if (dockerfile) { let [cmdRes, convertRes] = await cli.convertDockerfile(dockerfile); diff --git a/test/builds/first/stacker.yaml b/test/builds/first/stacker.yaml index 88fcfa1..42db05c 100644 --- a/test/builds/first/stacker.yaml +++ b/test/builds/first/stacker.yaml @@ -3,12 +3,12 @@ layer1_1: type: docker url: docker://centos:latest import: - - import1 + - importfile1 run: | - cp /stacker/imports/import1 /root/import1 + cp /stacker/imports/importfile1 /root/importfile1 layer1_2: from: type: docker url: docker://centos:latest run: - touch /root/import0 + touch /root/importfile0 diff --git a/test/builds/second/stacker.yaml b/test/builds/second/stacker.yaml index bac37cb..1657ef6 100644 --- a/test/builds/second/stacker.yaml +++ b/test/builds/second/stacker.yaml @@ -1,12 +1,12 @@ config: prerequisites: - - ../sub1/stacker.yaml + - ../first/stacker.yaml layer2: from: type: built tag: layer1_1 import: - - import2 + - importfile2 run: | - cp /stacker/imports/import2 /root/import2 - cp /root/import1 /root/import1_copied + cp /stacker/imports/importfile2 /root/importfile2 + cp /root/importfile1 /root/importfile1_copied diff --git a/test/builds/third/stacker.yaml b/test/builds/third/stacker.yaml index 89f9a81..a9fe4a9 100644 --- a/test/builds/third/stacker.yaml +++ b/test/builds/third/stacker.yaml @@ -1,16 +1,16 @@ config: prerequisites: - - ../sub1/stacker.yaml - - ../sub2/stacker.yaml + - ../first/stacker.yaml + - ../second/stacker.yaml layer3_1: from: type: built tag: layer2 run: | - cp /root/import2 /root/import2_copied + cp /root/importfile2 /root/importfile2_copied layer3_2: from: type: built tag: layer1_2 run: | - cp /root/import0 /root/import0_copied + cp /root/importfile0 /root/importfile0_copied