Skip to content

Commit

Permalink
Push to correct ECR
Browse files Browse the repository at this point in the history
  • Loading branch information
bill-buchan committed Jan 9, 2025
1 parent d208313 commit d04abc6
Showing 1 changed file with 35 additions and 45 deletions.
80 changes: 35 additions & 45 deletions .github/workflows/oracle-observer-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,32 +138,32 @@ jobs:
run: |
docker load --input /tmp/oracle-observer-image.tar
- name: Trivy scan
uses: aquasecurity/trivy-action@915b19bbe73b92a6cf82a1bc12b087c9a19a5fe2
with:
format: 'sarif'
severity: 'CRITICAL,HIGH'
limit-severities-for-sarif: 'true'
image-ref: 'hmpps-delius-operational-automation:${{ github.sha }}'
exit-code: '1'
scan-type: 'image'
trivyignores: 'docker/oracle-observer/.trivyignore'
ignore-unfixed: 'true'
output: 'trivy-results.sarif'

- name: Upload artifact
uses: actions/upload-artifact@v4
if: failure() # If Trivy found vulnerabilities
with:
name: trivy-file
path: trivy-results.sarif
retention-days: 1

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
if: failure() # If Trivy found vulnerabilities
with:
sarif_file: 'trivy-results.sarif'
# - name: Trivy scan
# uses: aquasecurity/trivy-action@915b19bbe73b92a6cf82a1bc12b087c9a19a5fe2
# with:
# format: 'sarif'
# severity: 'CRITICAL,HIGH'
# limit-severities-for-sarif: 'true'
# image-ref: 'hmpps-delius-operational-automation:${{ github.sha }}'
# exit-code: '1'
# scan-type: 'image'
# trivyignores: 'docker/oracle-observer/.trivyignore'
# ignore-unfixed: 'true'
# output: 'trivy-results.sarif'

# - name: Upload artifact
# uses: actions/upload-artifact@v4
# if: failure() # If Trivy found vulnerabilities
# with:
# name: trivy-file
# path: trivy-results.sarif
# retention-days: 1

# - name: Upload Trivy scan results to GitHub Security tab
# uses: github/codeql-action/upload-sarif@v3
# if: failure() # If Trivy found vulnerabilities
# with:
# sarif_file: 'trivy-results.sarif'

publish-observer-image:
name: Publish image
Expand All @@ -172,29 +172,18 @@ jobs:
contents: write
packages: write
runs-on: ubuntu-latest
outputs:
new_tag: ${{ steps.bump-version.outputs.new_tag }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Bump version and push tag
id: bump-version
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: false
DEFAULT_BUMP: minor # Making this default visible
TAG_CONTEXT: repo # Making this default visible
PRERELEASE: ${{ github.base_ref != 'refs/heads/main' }}
PRERELEASE_SUFFIX: ${{ github.base_ref }} # Branch name

- name: Create safe tag
id: safe_tag
run: |
echo "SAFE_TAG=$(echo ${{ steps.bump-version.outputs.new_tag }} | sed 's/[^a-zA-Z0-9.]/-/g')" >> $GITHUB_OUTPUT
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: "arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/modernisation-platform-oidc-cicd"
role-session-name: "hmpps-delius-operational-automation-oracle-observer-${{ github.run_number }}"
aws-region: eu-west-2

- name: Download Artifact
uses: actions/download-artifact@v4
Expand All @@ -205,7 +194,7 @@ jobs:
- name: Load and retag image for publish
run: |
docker load --input /tmp/oracle-observer-image.tar
docker tag hmpps-delius-operational-automation:${{ github.sha }} ghcr.io/ministryofjustice/hmpps-delius-operational-automation-oracle-observer:${{ steps.safe_tag.outputs.SAFE_TAG }}
docker tag delius-core-oracle-observer:${{ github.sha }} 374269020027.dkr.ecr.eu-west-2.amazonaws.com/delius-core-oracle-observer:${{ github.run_id }}-${{ github.run_attempt }}
- name: Log into ghcr
uses: docker/login-action@v3
Expand All @@ -215,5 +204,6 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Publish image
run: docker push ghcr.io/ministryofjustice/hmpps-delius-operational-automation-oracle-observer:${{ steps.safe_tag.outputs.SAFE_TAG }}
run: docker push 374269020027.dkr.ecr.eu-west-2.amazonaws.com/delius-core-oracle-observer:${{ github.run_id }}-${{ github.run_attempt }}, 374269020027.dkr.ecr.eu-west-2.amazonaws.com/delius-core-oracle-observer:latest


0 comments on commit d04abc6

Please sign in to comment.