From bb98cec6987c5894240a5782ce447c1d37e9699a Mon Sep 17 00:00:00 2001 From: Petu Eusebiu Date: Tue, 5 Apr 2022 12:09:28 +0300 Subject: [PATCH] publish to unsecure oci registry tests Signed-off-by: Petu Eusebiu --- .github/workflows/build.yaml | 7 ++++ test/publish.bats | 79 ++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c5b57c2b..5a10c5ba 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -13,6 +13,11 @@ on: jobs: build: runs-on: ubuntu-20.04 + services: + registry: + image: registry:2 + ports: + - 5000:5000 strategy: matrix: go-version: ${{fromJson(inputs.go-version)}} @@ -36,6 +41,8 @@ jobs: (cd /tmp && git clone https://github.com/anuvu/squashfs && cd squashfs && make && sudo cp squashtool/squashtool /usr/bin) - run: | make check PRIVILEGE_LEVEL=${{ matrix.privilege-level }} + env: + REGISTRY_URL: localhost:5000 - uses: actions/cache@v2 id: restore-build with: diff --git a/test/publish.bats b/test/publish.bats index e444bc65..f9d83bc5 100644 --- a/test/publish.bats +++ b/test/publish.bats @@ -150,3 +150,82 @@ function teardown() { mount -t squashfs oci/blobs/sha256/$layer1 layer1 [ -f layer1/root/ls_out ] } + +@test "publish tag to unsecure registry" { + if [ -z "${REGISTRY_URL}" ]; then + skip "skipping test because no registry found in REGISTRY_URL env variable" + fi + + stacker build -f ocibuilds/sub4/stacker.yaml + stacker publish --skip-tls -f ocibuilds/sub4/stacker.yaml --url docker://${REGISTRY_URL} --tag test1 + + # check content of published image + # should have /root/ls_out from sub4/stacker.yaml + mkdir -p ocibuilds/sub7 + cat > ocibuilds/sub7/stacker.yaml < ocibuilds/sub8/stacker.yaml < ocibuilds/sub9/stacker.yaml < ocibuilds/sub10/stacker.yaml <