From 1dd202e33131791d374abcd873dbb0d5526109ef Mon Sep 17 00:00:00 2001 From: Pete Wall Date: Wed, 14 Dec 2022 10:22:10 -0600 Subject: [PATCH] Use a custom image for testing, rather than the same image. New restriction prevents attaching docker images with the same name and tag, so need to generate a new name and tag each time Signed-off-by: Pete Wall --- ci/pipeline.yaml | 110 ++++++++++++++------- ci/tasks/test-container-image-product.yaml | 10 ++ 2 files changed, 86 insertions(+), 34 deletions(-) diff --git a/ci/pipeline.yaml b/ci/pipeline.yaml index 0c5f919..b13e024 100644 --- a/ci/pipeline.yaml +++ b/ci/pipeline.yaml @@ -8,7 +8,7 @@ resource_types: type: registry-image source: repository: harbor-repo.vmware.com/dockerhub-proxy-cache/concourse/github-release-resource - tag: 1.6.4 + tag: 1.8.0 username: ((harbor.username)) password: ((harbor.token)) @@ -32,7 +32,7 @@ resource_types: type: registry-image source: repository: harbor-repo.vmware.com/dockerhub-proxy-cache/arbourd/concourse-slack-alert-resource - tag: v0.15.0 + tag: v0.16.1 username: ((harbor.username)) password: ((harbor.token)) @@ -89,15 +89,30 @@ resources: repository: marketplace-cli access_token: ((github.access_token)) - - name: test-container-image + - name: scratch type: registry-image icon: docker source: - repository: harbor-repo.vmware.com/dockerhub-proxy-cache/library/ubuntu - tag: 20.04 + repository: harbor-repo.vmware.com/dockerhub-proxy-cache/library/scratch username: ((harbor.username)) password: ((harbor.token)) + - name: test-container-image + type: registry-image + icon: docker + source: + repository: projects.registry.vmware.com/tanzu_isv_engineering/test-container-image + username: ((harbor-public.username)) + password: ((harbor-public.token)) + +# - name: test-container-image2 +# type: registry-image +# icon: docker +# source: +# repository: projects.registry.vmware.com/tanzu_isv_engineering/test-container-image2 +# username: ((harbor-public.username)) +# password: ((harbor-public.token)) + - name: test-container-product-version type: semver icon: gitlab @@ -341,34 +356,61 @@ jobs: params: bump: minor + - name: update-test-container-images + max_in_flight: 1 + plan: + - in_parallel: + - get: mkpcli + trigger: true + passed: [ build ] + - get: mkpcli_source + resource: source + passed: [ build ] + - get: version + passed: [ build ] + - get: scratch + params: + format: oci + - put: test-container-product-version + inputs: detect + params: { bump: patch } + - in_parallel: + - put: test-container-image + inputs: detect + params: + image: scratch/image.tar + additional_tags: test-container-product-version/version +# - put: test-container-image2 +# inputs: detect +# params: +# image: scratch/image.tar +# additional_tags: test-container-product-version/version + - name: test-publish-container-product public: true max_in_flight: 1 plan: - in_parallel: - get: test-container-product-version - params: { bump: patch } + passed: [update-test-container-images] - get: mkpcli trigger: true - passed: [build] + passed: [update-test-container-images] - get: source - passed: [build] + passed: [update-test-container-images] - get: version - passed: [build] + passed: [update-test-container-images] - get: test-container-image - params: - format: oci - - task: get-current-product - image: mkpcli - params: - MARKETPLACE_ENV: staging - PRODUCT_SLUG: test-container-product-5-1 - file: source/ci/tasks/get-current-product.yaml - output_mapping: {output: previous} - - put: test-container-product-version - inputs: detect - params: - file: test-container-product-version/version + passed: [update-test-container-images] +# - get: test-container-image2 +# passed: [update-test-container-images] +# - task: get-current-product +# image: mkpcli +# params: +# MARKETPLACE_ENV: staging +# PRODUCT_SLUG: test-container-product-5-1 +# file: source/ci/tasks/get-current-product.yaml +# output_mapping: {output: previous} - task: add-container-image-to-marketplace image: mkpcli file: source/ci/tasks/test-container-image-product.yaml @@ -376,8 +418,8 @@ jobs: params: MARKETPLACE_ENV: staging PRODUCT_SLUG: test-container-product-5-1 - TEST_IMAGE_REPO: docker.io/bitnami/nginx - TEST_IMAGE_TAG: 1.21.1 + TEST_IMAGE_REPO: projects.registry.vmware.com/tanzu_isv_engineering/test-container-image + TEST_IMAGE_TAG_FILE: version/version - task: add-metafile image: mkpcli file: source/ci/tasks/attach-metafile.yaml @@ -386,16 +428,16 @@ jobs: MARKETPLACE_ENV: staging PRODUCT_SLUG: test-container-product-5-1 METAFILE_TYPE: cli - - task: add-container-image-to-existing-version - image: mkpcli - file: source/ci/tasks/test-container-image-product.yaml - input_mapping: { version: test-container-product-version } - params: - MARKETPLACE_ENV: staging - PRODUCT_SLUG: test-container-product-5-1 - TEST_IMAGE_REPO: harbor-repo.vmware.com/dockerhub-proxy-cache/library/ubuntu - TEST_IMAGE_TAG: 20.04 - TEST_IMAGE_FILE: test-container-image/image.tar +# - task: add-container-image-to-existing-version +# image: mkpcli +# file: source/ci/tasks/test-container-image-product.yaml +# input_mapping: { version: test-container-product-version } +# params: +# MARKETPLACE_ENV: staging +# PRODUCT_SLUG: test-container-product-5-1 +# TEST_IMAGE_REPO: harbor-repo.vmware.com/dockerhub-proxy-cache/library/ubuntu +# TEST_IMAGE_TAG: 20.04 +# TEST_IMAGE_FILE: test-container-image/image.tar - task: set-osl image: mkpcli file: source/ci/tasks/set-osl-file.yaml diff --git a/ci/tasks/test-container-image-product.yaml b/ci/tasks/test-container-image-product.yaml index fba5083..f648b5c 100644 --- a/ci/tasks/test-container-image-product.yaml +++ b/ci/tasks/test-container-image-product.yaml @@ -10,6 +10,7 @@ params: PRODUCT_SLUG: TEST_IMAGE_REPO: TEST_IMAGE_TAG: + TEST_IMAGE_TAG_FILE: TEST_IMAGE_FILE: MKPCLI_DEBUG: true MKPCLI_DEBUG_REQUEST_PAYLOADS: true @@ -25,6 +26,15 @@ run: - | set -ex VERSION=$(cat version/version) + + if [ -z "${TEST_IMAGE_TAG}" ]; then + if [ ! -z "${TEST_IMAGE_TAG_FILE}" ]; then + TEST_IMAGE_TAG=$(cat "${TEST_IMAGE_TAG_FILE}") + else + echo "TEST_IMAGE_TAG or TEST_IMAGE_TAG_FILE must be defined" + exit 1 + fi + fi if [ -z "${TEST_IMAGE_FILE}" ]; then # Attach a public container image