Skip to content

Commit

Permalink
DEVOPS-1298: registry cache in CI pipelines (#561)
Browse files Browse the repository at this point in the history
* feat: DEVOPS-1298 registry cache in CI pipelines

* feat: DEVOPS-1298 registry cache in CI pipelines

* feat: DEVOPS-1298 registry cache in CI pipelines

* feat: DEVOPS-1298 registry cache in CI pipelines

* feat: DEVOPS-1298 registry cache in CI pipelines

* feat: DEVOPS-1298 registry cache in CI pipelines

* feat: DEVOPS-1298 registry cache in CI pipelines
  • Loading branch information
pavlops authored Mar 20, 2024
1 parent d95d665 commit ca89022
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 38 deletions.
69 changes: 51 additions & 18 deletions .github/workflows/cicd-prd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ jobs:
application:
[
bluebell-playground,
developer-portal,
devex,
devex-apollo,
dev-wallet,
faucet-service,
Expand All @@ -37,24 +35,13 @@ jobs:
zillion,
zilliqa-bridge-validator,
zilliqa-bridge-web,
zilliqa-isolated-server,
]
include:
- application: bluebell-playground
image_name: bluebell-playground
path: products/bluebell
tag_length: 8
tag_latest: false
- application: developer-portal
image_name: developer-portal
path: products/developer-portal
tag_length: 8
tag_latest: false
- application: devex
image_name: devex
path: products/devex
tag_length: 8
tag_latest: false
- application: devex-apollo
image_name: devex-apollo
path: products/devex-apollo
Expand Down Expand Up @@ -105,11 +92,6 @@ jobs:
path: products/zillion
tag_length: 8
tag_latest: false
- application: zilliqa-isolated-server
image_name: zilliqa-isolated-server
path: products/zilliqa-isolated-server
tag_length: 8
tag_latest: true
- application: zilliqa-bridge-validator
image_name: zilliqa-bridge-validator
path: products/bridge/bridge-validators
Expand All @@ -132,6 +114,57 @@ jobs:
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0

- name: Docker build and push - production
uses: Zilliqa/gh-actions-workflows/actions/ci-dockerized-app-build-push@v2
with:
context: ${{ matrix.path }}
push: true
tag: asia-docker.pkg.dev/prj-p-devops-services-tvwmrf63/zilliqa-public/${{ matrix.image_name }}:${{ github.ref_name }}
registry: asia-docker.pkg.dev
workload-identity-provider: "${{ secrets.GCP_PRD_GITHUB_WIF }}"
service-account: "${{ secrets.GCP_PRD_GITHUB_SA_DOCKER_REGISTRY }}"
cache-key: ${{ env.REGISTRY }}/${{ matrix.image_name }}-cache
build-args: |
DEPLOY_ENV=prd
build-makefile:
permissions:
id-token: write
contents: write
runs-on: ubuntu-22.04
name: "Build image with Makefile"
strategy:
fail-fast: false
matrix:
application: [developer-portal, devex, zilliqa-isolated-server]
include:
- application: developer-portal
image_name: developer-portal
path: products/developer-portal
tag_length: 8
tag_latest: false
- application: devex
image_name: devex
path: products/devex
tag_length: 8
tag_latest: false
- application: zilliqa-isolated-server
image_name: zilliqa-isolated-server
path: products/zilliqa-isolated-server
tag_length: 8
tag_latest: true
env:
DOCKER_DOMAIN: asia-docker.pkg.dev
REGISTRY: asia-docker.pkg.dev/prj-p-devops-services-tvwmrf63/zilliqa-public
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0

- name: "Authenticate to Google Cloud - production"
id: google-auth
uses: "google-github-actions/auth@v1"
Expand Down
74 changes: 56 additions & 18 deletions .github/workflows/cicd-stg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ jobs:
matrix:
application:
[
developer-portal,
devex,
devex-apollo,
dev-wallet,
faucet-service,
Expand All @@ -34,19 +32,10 @@ jobs:
neo-savant,
scilla-server,
zillion,
zilliqa-isolated-server,
zilliqa-bridge-validator,
zilliqa-bridge-web,
]
include:
- application: developer-portal
image_name: developer-portal
path: products/developer-portal
tag_length: 8
tag_latest: false
- application: devex
image_name: devex
path: products/devex
tag_length: 8
tag_latest: false
- application: devex-apollo
image_name: devex-apollo
path: products/devex-apollo
Expand Down Expand Up @@ -97,11 +86,6 @@ jobs:
path: products/zillion
tag_length: 8
tag_latest: false
- application: zilliqa-isolated-server
image_name: zilliqa-isolated-server
path: products/zilliqa-isolated-server
tag_length: 8
tag_latest: true
- application: zilliqa-bridge
image_name: zilliqa-bridge-validator
path: products/bridge/bridge-validators
Expand All @@ -115,6 +99,60 @@ jobs:
env:
DOCKER_DOMAIN: asia-docker.pkg.dev
REGISTRY: asia-docker.pkg.dev/prj-d-devops-services-4dgwlsse/zilliqa-public
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: "true"
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0

- name: Docker build and push - staging
uses: Zilliqa/gh-actions-workflows/actions/ci-dockerized-app-build-push@v2
with:
context: ${{ matrix.path }}
push: ${{ github.ref_name == github.event.repository.default_branch }}
tag: asia-docker.pkg.dev/prj-d-devops-services-4dgwlsse/zilliqa-public/${{ matrix.image_name }}
tag-length: ${{ matrix.tag_length }}
tag-latest: ${{ matrix.tag_latest }}
registry: asia-docker.pkg.dev
workload-identity-provider: "${{ secrets.GCP_PRD_GITHUB_WIF }}"
service-account: "${{ secrets.GCP_STG_GITHUB_SA_DOCKER_REGISTRY }}"
cache-key: ${{ env.REGISTRY }}/${{ matrix.image_name }}-cache
build-args: |
DEPLOY_ENV=stg
build-makefile:
permissions:
id-token: write
contents: write
runs-on: ubuntu-22.04
if: github.actor != 'dependabot[bot]' && github.ref_name == 'main'
name: "Build image with Makefile"
strategy:
fail-fast: false
matrix:
application: [developer-portal, devex, zilliqa-isolated-server]
include:
- application: developer-portal
image_name: developer-portal
path: products/developer-portal
tag_length: 8
tag_latest: false
- application: devex
image_name: devex
path: products/devex
tag_length: 8
tag_latest: false
- application: zilliqa-isolated-server
image_name: zilliqa-isolated-server
path: products/zilliqa-isolated-server
tag_length: 8
tag_latest: true
env:
DOCKER_DOMAIN: asia-docker.pkg.dev
REGISTRY: asia-docker.pkg.dev/prj-d-devops-services-4dgwlsse/zilliqa-public
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion products/multisig/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ endif

## Build and push the Docker image
image/build-and-push:
docker build --build-arg REACT_APP_DEPLOY_ENV=${ENVIRONMENT} -t "${IMAGE_TAG}" .
docker build -t "${IMAGE_TAG}" .
docker push "${IMAGE_TAG}"
2 changes: 1 addition & 1 deletion products/zillion/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ endif

## Build and push the Docker image
image/build-and-push:
docker build --build-arg REACT_APP_DEPLOY_ENV=${ENVIRONMENT} -t "${IMAGE_TAG}" .
docker build -t "${IMAGE_TAG}" .
docker push "${IMAGE_TAG}"

0 comments on commit ca89022

Please sign in to comment.