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

github-action: provenance generation #2315

Merged
merged 21 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
14 changes: 10 additions & 4 deletions .github/workflows/release-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ on:
branches: [ "main" ]

permissions:
contents: write
issues: write
packages: write
contents: write
v1v marked this conversation as resolved.
Show resolved Hide resolved
id-token: write
issues: write
packages: write

env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
Expand Down Expand Up @@ -37,7 +38,12 @@ jobs:
secrets: |
secret/apm-team/ci/elastic-observability-feedz.io apiKey | REPO_API_KEY ;
secret/apm-team/ci/elastic-observability-feedz.io url | REPO_API_URL


- name: generate build provenance
uses: github-early-access/generate-build-provenance@main
with:
subject-path: "${{ github.workspace }}/build/output/_packages/*.nupkg"

# Github packages requires authentication, this is likely going away in the future so for now we publish to feedz.io
- name: publish canary packages to feedz.io
run: dotnet nuget push 'build/output/_packages/*.nupkg' -k ${REPO_API_KEY} -s ${REPO_API_URL} --skip-duplicate --no-symbols
Expand Down
64 changes: 50 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,21 @@ env:
jobs:
release:
runs-on: ubuntu-latest

env:
PREFIX_APM_AGENT: "build/output/ElasticApmAgent_"
PREFIX_APM_PROFILER: "build/output/elastic_apm_profiler_"
SUFFIX_APM_AGENT: ".zip"
SUFFIX_APM_PROFILER: "-linux-x64.zip"
permissions:
id-token: write
v1v marked this conversation as resolved.
Show resolved Hide resolved
contents: write
steps:
- uses: actions/checkout@v4
- name: Bootstrap Action Workspace
id: bootstrap
uses: ./.github/workflows/bootstrap
with:
rust: 'true'
rust: 'true'

- name: Package
run: ./build.sh pack
Expand All @@ -51,22 +58,41 @@ jobs:
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}

- name: Build Profiler Docker Image
continue-on-error: true #continue for now until we see it working in action
run: |
docker build . -t docker.elastic.co/observability/apm-agent-dotnet:${{ steps.bootstrap.outputs.agent-version }} \
--build-arg AGENT_ZIP_FILE=build/output/elastic_apm_profiler_${{ steps.bootstrap.outputs.agent-version }}-linux-x64.zip
- name: Push Profiler Docker Image
- name: Build and Push Profiler Docker Image
id: push
continue-on-error: true #continue for now until we see it working in action
run: |
for i in $(seq 1 3); do [ $i -gt 1 ] && sleep 15; docker push docker.elastic.co/observability/apm-agent-dotnet:${{ steps.bootstrap.outputs.agent-version }} && s=0 && break || s=$?; done; (exit $s)

uses: docker/[email protected]
with:
v1v marked this conversation as resolved.
Show resolved Hide resolved
context: .
push: true
tags: |
docker.elastic.co/observability/apm-agent-dotnet:${{ steps.bootstrap.outputs.agent-version }}
build-args: |
AGENT_ZIP_FILE=${{ env.PREFIX_APM_PROFILER }}${{ steps.bootstrap.outputs.agent-version }}${{ env.SUFFIX_APM_PROFILER }}

- name: Attest image
uses: github-early-access/generate-build-provenance@main
v1v marked this conversation as resolved.
Show resolved Hide resolved
with:
subject-name: "docker.elastic.co/observability/apm-agent-dotnet:${{ steps.bootstrap.outputs.agent-version }}"
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: false

- name: generate build provenance (APM Agent)
uses: github-early-access/generate-build-provenance@main
v1v marked this conversation as resolved.
Show resolved Hide resolved
with:
subject-path: "${{ github.workspace }}/${{ env.PREFIX_APM_AGENT }}${{ steps.bootstrap.outputs.agent-version }}${{ env.SUFFIX_APM_AGENT }}"

- name: generate build provenance (APM Profiler)
uses: github-early-access/generate-build-provenance@main
v1v marked this conversation as resolved.
Show resolved Hide resolved
with:
subject-path: "${{ github.workspace }}/${{ env.PREFIX_APM_PROFILER }}${{ steps.bootstrap.outputs.agent-version }}${{ env.SUFFIX_APM_PROFILER }}"

- name: Attach Profiler And Startup Hooks
continue-on-error: true #continue for now until we see it working in action
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.ref_name }} "build/output/ElasticApmAgent_${{ steps.bootstrap.outputs.agent-version }}.zip" "build/output/elastic_apm_profiler_${{ steps.bootstrap.outputs.agent-version }}-linux-x64.zip"
gh release upload ${{ github.ref_name }} "${{ env.PREFIX_APM_AGENT }}${{ steps.bootstrap.outputs.agent-version }}${{ env.SUFFIX_APM_AGENT }}" "${{ env.PREFIX_APM_PROFILER }}${{ steps.bootstrap.outputs.agent-version }}${{ env.SUFFIX_APM_PROFILER }}"

- if: ${{ success() }}
uses: elastic/apm-pipeline-library/.github/actions/slack-message@current
Expand Down Expand Up @@ -97,7 +123,12 @@ jobs:
outputs:
agent-version: ${{ steps.bootstrap.outputs.agent-version }}
major-version: ${{ steps.bootstrap.outputs.major-version }}

env:
PREFIX_ZIP_FILE: "build/output/elastic_apm_profiler_"
SUFFIX_ZIP_FILE: "-win-x64.zip"
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
- name: Bootstrap Action Workspace
Expand All @@ -109,12 +140,17 @@ jobs:
- name: Build profiler
run: ./build.bat profiler-zip

- name: generate build provenance (APM Profiler)
uses: github-early-access/generate-build-provenance@main
v1v marked this conversation as resolved.
Show resolved Hide resolved
with:
subject-path: "${{ github.workspace }}/${{ env.PREFIX_ZIP_FILE }}${{ steps.bootstrap.outputs.agent-version }}${{ env.SUFFIX_ZIP_FILE }}"

- name: Attach Profiler
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true #continue for now until we see it working in action
run: |
gh release upload ${{ github.ref_name }} "build/output/elastic_apm_profiler_${{ steps.bootstrap.outputs.agent-version }}-win-x64.zip"
gh release upload ${{ github.ref_name }} "${{ env.PREFIX_ZIP_FILE }}${{ steps.bootstrap.outputs.agent-version }}${{ env.SUFFIX_ZIP_FILE }}"

post-release:
needs: [ 'release-windows']
Expand Down
Loading