Skip to content

adicao do argocd

adicao do argocd #3

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Set version
run: echo "VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
- name: Docker Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build image
run: |
docker build \
-t infrascielo/delorean:${VERSION} \
-t infrascielo/delorean:latest \
.
# 🔐 Scan único (policy)
- name: Trivy Image Scan
uses: aquasecurity/trivy-action@0.20.0
with:
image-ref: infrascielo/delorean:${{ env.VERSION }}
severity: HIGH,CRITICAL
exit-code: 0
- name: Install Trivy CLI
run: |
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sudo sh -s -- -b /usr/local/bin
# 📄 Relatório (evidência)
- name: Trivy Report
run: |
trivy image \
--scanners vuln \
--severity HIGH,CRITICAL \
--format table \
--output trivy-report.txt \
infrascielo/delorean:${VERSION}
- uses: actions/upload-artifact@v4
with:
name: trivy-report
path: trivy-report.txt
# 📦 SBOM
- name: Generate SBOM (CycloneDX)
run: |
trivy image \
--scanners vuln \
--format cyclonedx \
--output sbom-${VERSION}.json \
infrascielo/delorean:${VERSION}
- uses: actions/upload-artifact@v4
with:
name: sbom-${{ env.VERSION }}
path: sbom-${{ env.VERSION }}.json
- name: Push image
run: |
docker push infrascielo/delorean:${VERSION}
docker push infrascielo/delorean:latest
- name: Get image digest
run: |
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' infrascielo/delorean:${VERSION})
echo "IMAGE_DIGEST=${DIGEST}" >> $GITHUB_ENV
- name: Install Cosign
uses: sigstore/cosign-installer@v3
- name: Sign image with Cosign
env:
COSIGN_EXPERIMENTAL: "1"
COSIGN_YES: "true"
run: |
cosign sign ${IMAGE_DIGEST}
- name: Verify image signature
env:
COSIGN_EXPERIMENTAL: "1"
run: |
cosign verify \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--certificate-identity-regexp "https://github.com/${{ github.repository }}/*" \
${IMAGE_DIGEST}
- name: Attach SBOM attestation
env:
COSIGN_EXPERIMENTAL: "1"
COSIGN_YES: "true"
run: |
cosign attest \
--predicate sbom-${VERSION}.json \
--type cyclonedx \
${IMAGE_DIGEST}
- name: Update GitOps Homolog
env:
GITOPS_TOKEN: ${{ secrets.GITOPS_TOKEN }}
run: |
git clone https://${GITOPS_TOKEN}@github.com/scieloorg/gitops.git
cd gitops
sed -i "s|digest: sha256:.*|digest: ${IMAGE_DIGEST#*@}|" \
apps/delorean/homolog/kustomization.yaml
git config user.name github-actions
git config user.email github-actions@github.com
git commit -am "HML ${VERSION}"
git push