Skip to content

Use same build ID retrieval mechanism as the agent #69

Use same build ID retrieval mechanism as the agent

Use same build ID retrieval mechanism as the agent #69

Workflow file for this run

name: Container
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
skip-check:
name: Skip check
continue-on-error: true
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip-check.outputs.should_skip }}
permissions:
actions: write
contents: read
steps:
- id: skip-check
uses: fkirc/skip-duplicate-actions@v5
with:
do_not_skip: '["schedule", "workflow_dispatch"]'
paths: |-
[
"**.go",
".dockerignore",
".github/workflows/container.yml",
"Dockerfile*",
"Makefile",
"go.mod",
"go.sum"
]
skip_after_successful_duplicate: false
build-binaries:
name: Build binaries using goreleaser
needs: skip-check
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
container:
image: docker.io/goreleaser/goreleaser-cross:v1.22.4
options: --privileged
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: "${{ env.goreleaser_current_tag }}"
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Run Goreleaser
run: goreleaser release --clean --verbose --snapshot
- name: Archive generated artifacts
uses: actions/upload-artifact@v4
with:
name: parca-debuginfo-dist-container
if-no-files-found: error
path: |
goreleaser/dist
!goreleaser/dist/*.txt
build-and-push-container:
name: Container build and push (when merged)
needs: build-binaries
runs-on: ubuntu-latest
container:
# https://github.com/containers/podman/tree/main/contrib/podmanimage
# Specifying SHA repeatedly fails:
# @sha256:421ac576cebff98e90c531e7b9ce4482370ecc7cee59abc2341714031bfb5f43
image: quay.io/containers/podman:v4.1.1
options: >-
--device /dev/fuse:rw
--privileged
--security-opt label=disable
--security-opt seccomp=unconfined
permissions:
id-token: write
packages: write
contents: read
steps:
- name: Install dependencies
run: dnf install --assumeyes --repo fedora git make jq
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
check-latest: true
- uses: actions/download-artifact@v4
with:
name: parca-debuginfo-dist-container
path: goreleaser/dist
- name: Build container
run: make container
- name: Check images are created
run: podman images | grep 'ghcr.io/parca-dev/parca-debuginfo'
- name: Install cosign
if: ${{ github.event_name != 'pull_request' }}
uses: sigstore/cosign-installer@v3
- name: Login to registry
if: ${{ github.event_name != 'pull_request' }}
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | podman login -u parca-dev --password-stdin ghcr.io
- name: Install crane
if: ${{ github.event_name != 'pull_request' }}
uses: imjasonh/[email protected]
- name: Push and sign container
if: ${{ github.event_name != 'pull_request' }}
env:
COSIGN_EXPERIMENTAL: true
run: |
make push-container
make sign-container