Skip to content

Commit

Permalink
Merge pull request #156 from alanjino/main
Browse files Browse the repository at this point in the history
cosign added
  • Loading branch information
jebinjeb authored Aug 11, 2023
2 parents 81b29c7 + 5e8de36 commit 2f104db
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 84 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/agent-docker-cosign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Agent Docker Image CI

on:
push:
paths-ignore:
- '**.md'
- 'charts/**'
branches:
- 'main'
tags:
- 'v*..'
pull_request:
branches:
- 'main'

jobs:

build:

runs-on: ubuntu-latest
permissions:
packages: write
id-token: write
contents: read
actions: read
security-events: write
env:
REGISTRY: ghcr.io
GH_URL: https://github.com
steps:
- name: Checkout GitHub Action
uses: actions/checkout@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Docker metadata
id: metadata
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value={{sha}},enable=${{ github.ref_type != 'tag' }}
flavor: |
latest=true
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.TOKEN }}

- name: Build image and push to GitHub Container Registry
uses: docker/build-push-action@v4
with:
context: .
file: ./dockerfiles/agent/kubviz/Dockerfile
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ github.run_id }}
labels: ${{ steps.metadata.outputs.labels }}

push: true

- name: Install cosign
uses: sigstore/cosign-installer@main

- name: Sign the images
run: |
cosign sign -y ${{ env.REGISTRY }}/${{ github.repository }}:${{ github.run_id }}
env:
COSIGN_EXPERIMENTAL: 1

- name: Verify the pushed tags
run: cosign verify ${{ env.REGISTRY }}/${{ github.repository }}:${{ github.run_id }} --certificate-identity ${{ env.GH_URL }}/${{ github.repository }}/.github/workflows/agent-docker-cosign.yml@refs/heads/main --certificate-oidc-issuer https://token.actions.githubusercontent.com
env:
COSIGN_EXPERIMENTAL: 1

- name: Run Trivy in GitHub SBOM mode and submit results to Dependency Graph
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
format: 'github'
output: 'dependency-results.sbom.json'
image-ref: '.'
github-pat: ${{ secrets.TOKEN }}
84 changes: 0 additions & 84 deletions .github/workflows/agent-docker-image.yml

This file was deleted.

0 comments on commit 2f104db

Please sign in to comment.