Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI/CD options #2

Merged
merged 3 commits into from
Jan 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 52 additions & 21 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,60 @@ jobs:
- name: Build the project
run: |
make build

container-build-and-push-sha:
runs-on: ubuntu-latest

socket-exporter-build-dev:
uses: celo-org/reusable-workflows/.github/workflows/[email protected]
name: Build us-west1-docker.pkg.dev/devopsre/dev-images/socket-exporter
needs: build
permissions:
contents: read
id-token: write
security-events: write
steps:
- uses: actions/checkout@v4
- name: Login at GCP Artifact Registry
uses: celo-org/reusable-workflows/.github/actions/auth-gcp-artifact-registry@main
with:
workload-id-provider: 'projects/1094498259535/locations/global/workloadIdentityPools/gh-socket-exporter-main/providers/github-by-repos'
service-account: '[email protected]'
docker-gcp-registries: us-west1-docker.pkg.dev
- name: Build and push container
uses: celo-org/reusable-workflows/.github/actions/build-container@main
with:
platforms: linux/amd64,linux/arm64
registry: us-west1-docker.pkg.dev/devopsre/socket-exporter/socket-exporter
tag: ${{ github.sha }}
context: .
dockerfile: ./Dockerfile
push: ${{ fromJSON(true) }}
load: ${{ fromJSON(false) }}
if: |
github.ref != 'refs/heads/main'
with:
workload-id-provider: 'projects/1094498259535/locations/global/workloadIdentityPools/gh-socket-exporter/providers/github-by-repos'
service-account: '[email protected]'
artifact-registry: us-west1-docker.pkg.dev/devopsre/dev-images/socket-exporter
tags: test
context: .
file: ./Dockerfile
trivy: true

socket-exporter-build-main:
uses: celo-org/reusable-workflows/.github/workflows/[email protected]
name: Build us-west1-docker.pkg.dev/devopsre/socket-exporter/socket-exporter
needs: build
permissions:
contents: read
id-token: write
security-events: write
if: |
github.ref == 'refs/heads/main'
with:
workload-id-provider: 'projects/1094498259535/locations/global/workloadIdentityPools/gh-socket-exporter-main/providers/github-by-repos'
service-account: '[email protected]'
artifact-registry: us-west1-docker.pkg.dev/devopsre/socket-exporter/socket-exporter
tags: latest
context: .
file: ./Dockerfile
trivy: true

socket-exporter-build-tag:
uses: celo-org/reusable-workflows/.github/workflows/[email protected]
name: Build us-west1-docker.pkg.dev/devopsre/socket-exporter/socket-exporter tag
needs: build
permissions:
contents: read
id-token: write
security-events: write
if: |
startsWith(github.ref, 'refs/tags/socket-exporter-')
with:
workload-id-provider: projects/1094498259535/locations/global/workloadIdentityPools/gh-socket-exporter/providers/github-by-repos
service-account: '[email protected]'
artifact-registry: us-west1-docker.pkg.dev/devopsre/socket-exporter/socket-exporter
tags: ${{ github.ref_name }}
context: .
file: ./Dockerfile
trivy: true