Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: Rajpal Chauhan <[email protected]>
  • Loading branch information
rajpalc7 committed Feb 24, 2024
1 parent 58f363f commit 10662f3
Showing 1 changed file with 35 additions and 28 deletions.
63 changes: 35 additions & 28 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand Down Expand Up @@ -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

Expand All @@ -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}"
Expand All @@ -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
Expand All @@ -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}"
Expand All @@ -149,33 +155,17 @@ 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)
uses: redhat-actions/s2i-build@v2
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)
Expand All @@ -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)
Expand Down

0 comments on commit 10662f3

Please sign in to comment.