Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
43 changes: 38 additions & 5 deletions .github/workflows/build_docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ on:
required: true
type: string

build_rpm:
type: boolean
required: false
default: true

build_deb:
type: boolean
required: false
default: true

jobs:
packaging:
name: packaging (${{ matrix.os.name }})
Expand All @@ -35,6 +45,15 @@ jobs:
- { name: fc43, type: rpm, path: "docker/fedora", base-image: fedora:43 }
- { name: debian_13, type: deb, path: "docker/debian" , base-image: debian:13-slim }
- { name: ubuntu_24.04, type: deb, path: "docker/ubuntu", base-image: ubuntu:24.04 }
build-rpm:
- ${{ inputs.build_rpm }}
build-deb:
- ${{ inputs.build_deb}}
exclude:
- os: {type: rpm}
build-rpm: false
- os: {type: deb}
build-deb: false

steps:
# See deb and rpm steps.
Expand Down Expand Up @@ -118,11 +137,25 @@ jobs:
runs-on: ${{ inputs.arch == 'x86_64' && 'ubuntu-24.04' || inputs.arch == 'aarch64' && 'ubuntu-24.04-arm'}}
timeout-minutes: 10
env:
DOCKER_ARTIFACT_NAME: alumet-agent-${{ inputs.version }}-${{ inputs.release-version }}.${{ matrix.os }}.${{ inputs.arch }}.docker.tar
DOCKER_ARTIFACT_NAME: alumet-agent-${{ inputs.version }}-${{ inputs.release-version }}.${{ matrix.os.name }}.${{ inputs.arch }}.docker.tar
strategy:
fail-fast: false
matrix:
os: ["ubi9.6", "ubi10.1", "fc43", "debian_13", "ubuntu_24.04"]
os:
- { name: ubi10.1, type: rpm, path: "docker/ubi", base-image: registry.access.redhat.com/ubi10-micro:10.1, builder-image: registry.access.redhat.com/ubi10:10.1, libssl-version: 3, libcrypto-version: 3, latest_tag: true}
- { name: ubi9.6, type: rpm, path: "docker/ubi", base-image: registry.access.redhat.com/ubi9-micro:9.6, builder-image: registry.access.redhat.com/ubi9:9.6, libssl-version: 3, libcrypto-version: 3, latest_tag: true}
- { name: fc43, type: rpm, path: "docker/fedora", base-image: fedora:43 }
- { name: debian_13, type: deb, path: "docker/debian" , base-image: debian:13-slim }
- { name: ubuntu_24.04, type: deb, path: "docker/ubuntu", base-image: ubuntu:24.04 }
build-rpm:
- ${{ inputs.build_rpm }}
build-deb:
- ${{ inputs.build_deb}}
exclude:
- os: {type: rpm}
build-rpm: false
- os: {type: deb}
build-deb: false
needs:
- packaging

Expand Down Expand Up @@ -150,12 +183,12 @@ jobs:
image_sha=$(docker load -q -i ./docker-artifacts/${{ needs.packaging.outputs.artifact_name }} | grep "Loaded image: "| awk '{ print $3 }' | head -1)
export GOSS_FILE=.github/dgoss_validate.yaml
set -o pipefail
dgoss run --cap-add=sys_ptrace --cap-add=perfmon --cap-add=sys_nice $image_sha 2>&1 | tee ${{ matrix.os }}-${{ inputs.arch }}-dgoss_tests_report.txt >> $GITHUB_STEP_SUMMARY
dgoss run --cap-add=sys_ptrace --cap-add=perfmon --cap-add=sys_nice $image_sha 2>&1 | tee ${{ matrix.os.name }}-${{ inputs.arch }}-dgoss_tests_report.txt >> $GITHUB_STEP_SUMMARY

- name: Upload tests reports
if: always() # never skip to have file even in case of test failure
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ inputs.arch }}-dgoss_tests_report.txt
path: ${{ matrix.os }}-${{ inputs.arch }}-dgoss_tests_report.txt
name: ${{ matrix.os.name }}-${{ inputs.arch }}-dgoss_tests_report.txt
path: ${{ matrix.os.name }}-${{ inputs.arch }}-dgoss_tests_report.txt
219 changes: 219 additions & 0 deletions .github/workflows/pr_check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
name: Build Alumet artefacts

on:
pull_request:
Comment thread
titouanj marked this conversation as resolved.
paths:
- ".github/**"
- "deb/**"
- "docker/**"
- "rpm/**"

permissions:
contents: read
issues: write
pull-requests: write

concurrency:
group: pr-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:

find-changes:
runs-on: ubuntu-latest
outputs:
run-rpm: ${{ steps.get-modified-files.outputs.rpm }}
run-deb: ${{ steps.get-modified-files.outputs.deb }}
run-all: ${{ steps.get-modified-files.outputs.github }}
steps:
- uses: actions/checkout@v7

- id: get-modified-files
uses: dorny/paths-filter@v4
with:
filters: |
rpm:
- 'docker/fedora/**'
- 'docker/ubi/**'
- 'rpm/**'
- '!rpm/**/*.md'
- '!rpm/**/.gitignore'

deb:
- 'deb/**'
- '!deb/**/*.md'
- '!deb/**/.gitignore'
Comment thread
titouanj marked this conversation as resolved.
- 'docker/debian/**'
- 'docker/ubuntu/**'

github:
- '.github/**'
- '!.github/**/*.md'

setup-input:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.vars.outputs.VERSION}}
revision: ${{ steps.vars.outputs.REVISION }}
steps:
- name: Retrieve build arguments
id: vars
run: |
TAG=$(curl -L https://api.github.com/repos/alumet-dev/alumet/releases/latest | jq -r '.tag_name')
echo "VERSION=${TAG#v}" >> "$GITHUB_OUTPUT"
REF=$(curl -sL "https://api.github.com/repos/alumet-dev/alumet/git/ref/tags/$TAG")

TYPE=$(echo "$REF" | jq -r '.object.type')
SHA=$(echo "$REF" | jq -r '.object.sha')

if [ "$TYPE" = "tag" ]; then
SHA=$(curl -sL \
"https://api.github.com/repos/alumet-dev/alumet/git/tags/$SHA" \
| jq -r '.object.sha')
fi
echo "REVISION=pr${{ github.event.pull_request.number }}SHA${SHA}" >> "$GITHUB_OUTPUT"

rpm:
Comment thread
titouanj marked this conversation as resolved.
uses: ./.github/workflows/build_rpm.yaml
if: ${{ needs.find-changes.outputs.run-rpm == 'true' || needs.find-changes.outputs.run-all == 'true' }}
strategy:
fail-fast: false
matrix:
arch: [x86_64, aarch64]
needs:
- find-changes
- setup-input
with:
arch: ${{ matrix.arch }}
version: ${{ needs.setup-input.outputs.version }}
release-version: ${{ needs.setup-input.outputs.revision }}

deb:
uses: ./.github/workflows/build_deb.yaml
if: ${{ needs.find-changes.outputs.run-deb == 'true' || needs.find-changes.outputs.run-all == 'true' }}
strategy:
fail-fast: false
matrix:
arch: [x86_64, aarch64]
needs:
- find-changes
- setup-input
with:
arch: ${{ matrix.arch }}
version: ${{ needs.setup-input.outputs.version }}
revision: ${{ needs.setup-input.outputs.revision }}

docker:
uses: ./.github/workflows/build_docker.yaml
if: always() && (needs.deb.result == 'success' || needs.rpm.result == 'success')
strategy:
fail-fast: false
matrix:
arch: [x86_64, aarch64]
with:
arch: ${{ matrix.arch }}
version: ${{ needs.setup-input.outputs.version }}
release-version: ${{ needs.setup-input.outputs.revision }}
needs:
- find-changes
- setup-input
- rpm
- deb

comment-output:
runs-on: ubuntu-latest
env:
ORDER: 'last' #could be 'first' or 'last'
SEARCH_STRING: "🔥 Generated artifacts 🔥"
BODY: "🔥 Generated artifacts 🔥"
needs:
- setup-input
- rpm
- deb
- docker
steps:
- name: Search for previous comment
id: find-comment
uses: actions/github-script@v9
with:
script: |
const opts = github.rest.issues.listComments.endpoint.merge({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});

// Paginate is used to retrieve the comments of every pages.
// See https://octokit.github.io/rest.js/v21/#pagination.
var comments = await github.paginate(opts)

// Reverse comments array if wanted
// (listComments returns the comments ordered by ascending ID).
if (process.env.ORDER === 'last') {
comments.reverse()
}

// Iterate over the comments array.
for (const comment of comments) {
if (comment.user.login !== 'github-actions[bot]') {
continue
}

if (comment.body.includes(process.env.SEARCH_STRING)) {
core.setOutput('comment-id', comment.id.toString())
break
}
}

- name: Get body
id: get-body
uses: actions/github-script@v9
with:
script: |
const body = process.env.BODY || "";

const runUrl =
`${context.serverUrl}/${context.repo.owner}/${context.repo.repo}` +
`/actions/runs/${context.runId}`;

const message = `### ${body}

---

Artefacts can be found there: ${runUrl}`;
core.info(`Generated comment body:\n${message}`);
console.log('Generated comment body:\n', message);
core.notice(`Comment body generated. Length: ${message.length}`);
core.setOutput('comment-body', message);

- name: Create a new comment
if: ${{ steps.find-comment.outputs.comment-id == '' }}
uses: actions/github-script@v9
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `${{ steps.get-body.outputs.comment-body }}`
})
Comment thread
titouanj marked this conversation as resolved.

- name: Update existing comment
if: ${{ steps.find-comment.outputs.comment-id != '' }}
uses: actions/github-script@v9
with:
script: |
const commentId = '${{ steps.find-comment.outputs.comment-id }}';
const body = `${{ steps.get-body.outputs.comment-body }}`;

core.info(`Updating comment ${commentId}`);
core.info(`Comment body:\n${body}`);

await github.rest.issues.updateComment({
comment_id: Number(commentId),
owner: context.repo.owner,
repo: context.repo.repo,
body
});

core.info(`Comment ${commentId} updated successfully`);
Loading