Skip to content

Commit 742d3c4

Browse files
authoredJan 28, 2025
feat: DEVOPS-1844 add image pipeline (#2)
1 parent 876bc12 commit 742d3c4

File tree

3 files changed

+111
-0
lines changed

3 files changed

+111
-0
lines changed
 

‎.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.git
22
.gitignore
3+
.github
34
.dockerignore
45
node_modules
56
npm-debug.log

‎.github/workflows/cicd-prd.yaml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "CICD production"
2+
3+
on:
4+
# On release
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
build:
10+
permissions:
11+
id-token: write
12+
contents: write
13+
runs-on: ubuntu-24.04
14+
if: github.actor != 'dependabot[bot]'
15+
name: "Build image"
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
application: [ethstats-server]
20+
include:
21+
- application: ethstats-server
22+
image_name: ethstats-server
23+
path: .
24+
tag_length: 8
25+
tag_latest: true
26+
env:
27+
REGISTRY: asia-docker.pkg.dev
28+
REPOSITORY: asia-docker.pkg.dev/prj-p-devops-services-tvwmrf63/zilliqa-public
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
32+
with:
33+
submodules: recursive
34+
ref: ${{ github.event.pull_request.head.ref }}
35+
repository: ${{ github.event.pull_request.head.repo.full_name }}
36+
fetch-depth: 0
37+
38+
- name: Docker build and push
39+
uses: Zilliqa/gh-actions-workflows/actions/ci-dockerized-app-build-push@v2
40+
with:
41+
file: ${{ matrix.file }}
42+
context: ${{ matrix.context }}
43+
push: ${{ github.ref_name == github.event.repository.default_branch }}
44+
tag: ${{ env.REPOSITORY }}/${{ matrix.image_name }}:${{ github.ref_name }}
45+
tag-length: 8
46+
tag-latest: ${{ matrix.tag_latest }}
47+
registry: ${{ env.REGISTRY }}
48+
workload-identity-provider: "${{ secrets.GCP_PRD_GITHUB_WIF }}"
49+
service-account: "${{ secrets.GCP_PRD_GITHUB_SA_DOCKER_REGISTRY }}"
50+
cache-key: ${{ env.REPOSITORY }}/${{ matrix.image_name }}-cache
51+
secrets: |
52+
"TOKEN=${{ secrets.GH_PAT }}"

‎.github/workflows/cicd-stg.yaml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: "CICD staging"
2+
3+
on:
4+
# Test run before merging
5+
pull_request:
6+
branches:
7+
- main
8+
# On merged
9+
push:
10+
branches:
11+
- main
12+
13+
jobs:
14+
build:
15+
permissions:
16+
id-token: write
17+
contents: write
18+
runs-on: ubuntu-24.04
19+
if: github.actor != 'dependabot[bot]'
20+
name: "Build image"
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
application: [ethstats-server]
25+
include:
26+
- application: ethstats-server
27+
image_name: ethstats-server
28+
file: Dockerfile
29+
context: "."
30+
tag_length: 8
31+
tag_latest: false
32+
env:
33+
REGISTRY: asia-docker.pkg.dev
34+
REPOSITORY: asia-docker.pkg.dev/prj-d-devops-services-4dgwlsse/zilliqa-public
35+
steps:
36+
- name: Checkout code
37+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
38+
with:
39+
submodules: recursive
40+
ref: ${{ github.event.pull_request.head.ref }}
41+
repository: ${{ github.event.pull_request.head.repo.full_name }}
42+
fetch-depth: 0
43+
44+
- name: Docker build and push
45+
uses: Zilliqa/gh-actions-workflows/actions/ci-dockerized-app-build-push@v2
46+
with:
47+
file: ${{ matrix.file }}
48+
context: ${{ matrix.context }}
49+
push: ${{ github.ref_name == github.event.repository.default_branch }}
50+
tag: ${{ env.REPOSITORY }}/${{ matrix.image_name }}
51+
tag-length: 8
52+
tag-latest: ${{ matrix.tag_latest }}
53+
registry: ${{ env.REGISTRY }}
54+
workload-identity-provider: "${{ secrets.GCP_PRD_GITHUB_WIF }}"
55+
service-account: "${{ secrets.GCP_STG_GITHUB_SA_DOCKER_REGISTRY }}"
56+
cache-key: ${{ env.REPOSITORY }}/${{ matrix.image_name }}-cache
57+
secrets: |
58+
"TOKEN=${{ secrets.GH_PAT }}"

0 commit comments

Comments
 (0)
Please sign in to comment.