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

feat: audit workflow for releases #1593

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
55 changes: 55 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: Audit Shas

on:
workflow_dispatch:
inputs:
### Required
environment:
description: "Deployment environment - dev/test/prod"
required: true
type: choice
options: ["dev","test","prod"]
default: "prod"
release:
description: 'release name'
required: true
type: string
default: "prod"
jobs:
login_and_checkout:
name: Login and checkout repo
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.oc_token }}
- uses: actions/checkout@v4
audit_packages:
name: Audit
runs-on: ubuntu-22.04
strategy:
matrix:
package: [dops, vehicles, frontend, scheduler, policy]
timeout-minutes: 10
steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.oc_token }}
- uses: actions/checkout@v4
- name: Audit the installed application for package sha vs deployed sha
run: |
oc login --token=${{ secrets.oc_token }} --server=${{ vars.oc_server }}
oc project c28f0c-${{ inputs.environment }} # Safeguard!
export GHCR_SHA=$(docker manifest inspect onroutebc-${{inputs.release}}-${{matrix.package}} | jq '.manifests[0].digest')
export SHA_LIST=$(oc get pods -l app.kubernetes.io/instance=onroutebc-${{inputs.release}} -l app.kubernetes.io/name=${{matrix.package}} -o yaml | grep imageID | grep ghcr | cut -d : -f 3)
for sha in ${SHA_LIST}
do
echo "onroutebc-${{inputs.release}}-${{matrix.package}} - pod:${sha} ghcr: ${GHCR_SHA}"
done

Loading