From 10662f330c1a47052f10a368e5aa674306e5b9d9 Mon Sep 17 00:00:00 2001 From: Rajpal Chauhan Date: Sat, 24 Feb 2024 03:34:42 -0800 Subject: [PATCH] test Signed-off-by: Rajpal Chauhan --- .github/workflows/main.yaml | 63 ++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index cafb3d26..802d3a36 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -40,7 +40,9 @@ jobs: GIT_REF: "" BRANCH: move-tests-to-askar PATH: docker/wallet/config - BUILDER_IMAGE: 'quay.io/fedora/postgresql-13:13' + SOURCE_IMAGE_REGISTRY: "hub.docker.com/" + SOURCE_IMAGE_NAME: "alpine" + SOURCE_IMAGE_TAG: "latest" - service: aries-endorser-backup GIT_REPO_URL: BCDevOps/backup-container GIT_REF: "" @@ -84,7 +86,9 @@ jobs: with: repository: ${{ matrix.GIT_REPO_URL }} ref: ${{ matrix.GIT_REF }} - +# ref: github.ref + + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -96,7 +100,14 @@ jobs: username: ${{ secrets[matrix.REGISTRY_USERNAME_SECRET_NAME]}} password: ${{ secrets[matrix.REGISTRY_PASSWORD_SECRET_NAME]}} - - name: Pull base image for proxy and Create Docker file + - name: Log in to the GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create Docker file if: contains(fromJSON('["aries-endorser-proxy"]'), matrix.service) run: | BASE_IMAGE="${SOURCE_IMAGE_REGISTRY}${SOURCE_IMAGE_NAME}:${SOURCE_IMAGE_TAG}" @@ -110,12 +121,7 @@ jobs: SOURCE_IMAGE_NAME: ${{ matrix.SOURCE_IMAGE_NAME }} SOURCE_IMAGE_TAG: ${{ matrix.SOURCE_IMAGE_TAG }} - - name: Log in to the GHCR - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Prepare docker tags for image id: meta @@ -137,7 +143,7 @@ jobs: io.openshift.build.source-location=${{ github.repositoryUrl }} io.openshift.build.commit.id=${{ github.sha }} - - name: Update Docker base image and pull the base image if access is required + - name: Update Docker base image if: matrix.SOURCE_IMAGE_REGISTRY != '' && contains(fromJSON('["aries-endorser-db","aries-endorser-agent","aries-endorser-backup","aries-endorser-api","aries-endorser-proxy"]'), matrix.service) run: | BASE_IMAGE="${SOURCE_IMAGE_REGISTRY}${SOURCE_IMAGE_NAME}:${SOURCE_IMAGE_TAG}" @@ -149,22 +155,6 @@ jobs: SOURCE_IMAGE_TAG: ${{ matrix.SOURCE_IMAGE_TAG }} file: ${{ matrix.SOURCE_CONTEXT_DIR }}/${{ matrix.DOCKER_FILE_PATH }} - - name: Build and push Docker image - id: docker_build - if: contains(fromJSON('["aries-endorser-agent","aries-endorser-backup","aries-endorser-api","aries-endorser-proxy"]'), matrix.service) - uses: docker/build-push-action@v5 - with: - context: ${{ matrix.SOURCE_CONTEXT_DIR }} - file: ${{ matrix.SOURCE_CONTEXT_DIR }}/${{ matrix.DOCKER_FILE_PATH }} - push: true - tags: ${{ steps.meta.outputs.tags }} - outputs: type=image,name=target - - - name: Extract Tags - id: extract - if: contains(fromJSON('["aries-endorser-db"]'), matrix.service) - run: echo "tags=$(echo '${{ steps.meta.outputs.tags }}' | grep -oE ':([^[:space:]]+)' | sed '/workflow/d' | sed 's/://g' | tr '\n' ' ')" >> $GITHUB_OUTPUT - - name: Build database image id: build_image if: contains(fromJSON('["aries-endorser-db"]'), matrix.service) @@ -172,10 +162,10 @@ jobs: with: path_context: ${{ matrix.PATH }} # Builder image for a java project - builder_image: ${{ matrix.BUILDER_IMAGE }} + builder_image: "${matrix.SOURCE_IMAGE_REGISTRY}${matrix.SOURCE_IMAGE_NAME}:${matrix.SOURCE_IMAGE_TAG}" image: ${{ env.GITHUB_IMAGE_REPO }}${{ matrix.service }} tags: ${{ steps.extract.outputs.tags }} - + - name: Push database image id: push if: contains(fromJSON('["aries-endorser-db"]'), matrix.service) @@ -186,6 +176,23 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + id: docker_build + if: contains(fromJSON('["aries-endorser-agent","aries-endorser-backup","aries-endorser-api","aries-endorser-proxy"]'), matrix.service) + uses: docker/build-push-action@v5 + with: + context: ${{ matrix.SOURCE_CONTEXT_DIR }} + file: ${{ matrix.SOURCE_CONTEXT_DIR }}/${{ matrix.DOCKER_FILE_PATH }} + push: true + tags: ${{ steps.meta.outputs.tags }} + outputs: type=image,name=target + + - name: Extract Tags + id: extract + if: contains(fromJSON('["aries-endorser-db"]'), matrix.service) + run: echo "tags=$(echo '${{ steps.meta.outputs.tags }}' | grep -oE ':([^[:space:]]+)' | sed '/workflow/d' | sed 's/://g' | tr '\n' ' ')" >> $GITHUB_OUTPUT + - name: Display ${{ matrix.service }} image results id: digests if: contains(fromJSON('["aries-endorser-db"]'), matrix.service)