ci: added install-sysdig script upload #573
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Build | |
on: | |
pull_request: | |
branches: [dev] | |
push: | |
branches: [dev] | |
workflow_dispatch: | |
jobs: | |
builder: | |
env: | |
REGISTRY: ghcr.io | |
BUILDER_IMAGE_BASE: ghcr.io/draios/sysdig-builder-pr | |
SKEL_BUILDER_IMAGE_BASE: ghcr.io/draios/sysdig-skel-builder-pr | |
BUILDER_DEV: ghcr.io/draios/sysdig-builder:dev | |
SKEL_BUILDER_DEV: ghcr.io/draios/sysdig-skel-builder:dev | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Sysdig | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Check if builder is modified | |
id: builder-files | |
uses: tj-actions/changed-files@v34 | |
with: | |
files: | | |
docker/builder/** | |
- name: Set up QEMU | |
if: steps.builder-files.outputs.any_changed == 'true' | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: 'amd64,arm64' | |
- name: Set up Docker Buildx | |
if: steps.builder-files.outputs.any_changed == 'true' | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Github Packages | |
if: steps.builder-files.outputs.any_changed == 'true' | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get new skeleton builder image tag | |
id: get-new-skeleton-builder | |
if: steps.builder-files.outputs.any_changed == 'true' | |
run: | | |
echo "name=skeleton_builder_image::${{ (github.event.pull_request.number != '') && format('{0}:{1}', env.SKEL_BUILDER_IMAGE_BASE, github.event.pull_request.number) || env.SKEL_BUILDER_DEV }}" >> $GITHUB_OUTPUT | |
- name: Get new builder image tag | |
id: get-new-builder | |
if: steps.builder-files.outputs.any_changed == 'true' | |
run: | | |
echo "name=builder_image::${{ (github.event.pull_request.number != '') && format('{0}:{1}', env.BUILDER_IMAGE_BASE, github.event.pull_request.number) || env.BUILDER_DEV }}" >> $GITHUB_OUTPUT | |
- name: Build new skeleton builder | |
id: skeleton-builder | |
if: steps.builder-files.outputs.any_changed == 'true' | |
uses: docker/build-push-action@v3 | |
with: | |
context: docker/builder | |
file: docker/builder/modern_bpf_probe.Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.get-new-skeleton-builder.outputs.skeleton_builder_image }} | |
push: true | |
- name: Build new builder | |
id: build-builder | |
if: steps.builder-files.outputs.any_changed == 'true' | |
uses: docker/build-push-action@v3 | |
with: | |
context: docker/builder | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.get-new-builder.outputs.builder_image }} | |
push: true | |
outputs: | |
builder_image: ${{ (steps.builder-files.outputs.any_changed == 'true') && steps.get-new-builder.outputs.builder_image || env.BUILDER_DEV }} | |
skeleton_builder_image: ${{ (steps.builder-files.outputs.any_changed == 'true') && steps.get-new-skeleton-builder.outputs.skeleton_builder_image || env.SKEL_BUILDER_DEV }} | |
build-skeleton-sysdig-linux-amd64: | |
needs: builder | |
runs-on: ubuntu-latest | |
container: | |
image: ${{ needs.builder.outputs.skeleton_builder_image }} | |
steps: | |
- name: Checkout Sysdig | |
uses: actions/checkout@v3 | |
with: | |
path: sysdig | |
- name: Link paths | |
run: | | |
mkdir -p /source | |
ln -s "$GITHUB_WORKSPACE/sysdig" /source/sysdig | |
- name: Prepare build skeleton | |
run: build cmake-skeleton | |
- name: Build skeleton | |
run: build make-skeleton | |
- name: Cache build skeleton | |
uses: actions/cache/save@v3 | |
if: always() | |
id: cache | |
with: | |
path: /build-skeleton | |
key: build-skeleton-${{ github.run_id }} | |
build-sysdig-linux-amd64: | |
needs: [builder,build-skeleton-sysdig-linux-amd64] | |
runs-on: ubuntu-latest | |
container: | |
image: ${{ needs.builder.outputs.builder_image }} | |
steps: | |
- name: Checkout Sysdig | |
uses: actions/checkout@v3 | |
with: | |
path: sysdig | |
- name: Link paths | |
run: | | |
mkdir -p /source | |
ln -s "$GITHUB_WORKSPACE/sysdig" /source/sysdig | |
- name: Restore build skeleton | |
id: cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: /build-skeleton | |
key: build-skeleton-${{ github.run_id }} | |
restore-keys: build-skeleton- | |
- name: Build | |
run: build cmake | |
- name: Build packages | |
run: build package | |
- name: Upload rpm package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sysdig-dev-linux-x86_64.rpm | |
path: | | |
/build/release/sysdig-*.rpm | |
- name: Upload deb package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sysdig-dev-linux-x86_64.deb | |
path: | | |
/build/release/sysdig-*.deb | |
- name: Upload tar.gz package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sysdig-dev-linux-x86_64.tar.gz | |
path: | | |
/build/release/sysdig-*.tar.gz | |
build-sysdig-linux-arm64: | |
needs: builder | |
env: | |
REGISTRY: ghcr.io | |
BUILDER_IMAGE_BASE: ghcr.io/draios/sysdig-builder-pr | |
SKEL_BUILDER_IMAGE_BASE: ghcr.io/draios/sysdig-skel-builder-pr | |
BUILDER_DEV: ghcr.io/draios/sysdig-builder:dev | |
SKEL_BUILDER_DEV: ghcr.io/draios/sysdig-skel-builder:dev | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Sysdig | |
uses: actions/checkout@v3 | |
with: | |
path: sysdig | |
- name: Create build dir | |
run: | | |
mkdir -p ${{ github.workspace }}/sysdig-build-aarch64 | |
- name: Login to Github Packages | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: 'amd64,arm64' | |
- name: Run the build skeleton process with Docker | |
uses: addnab/docker-run-action@v3 | |
with: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
registry: ${{ env.REGISTRY }} | |
image: ${{ needs.builder.outputs.skeleton_builder_image }} | |
options: --platform=linux/arm64 -v ${{ github.workspace }}/sysdig:/source/sysdig -v ${{ github.workspace }}/sysdig-build-aarch64:/build/dev-packages -v ${{ github.workspace }}/skeleton-build:/build-skeleton | |
run: | | |
mkdir -p /build/dev-packages && \ | |
build cmake-skeleton && \ | |
build make-skeleton | |
- name: Run the build process with Docker | |
uses: addnab/docker-run-action@v3 | |
with: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
registry: ${{ env.REGISTRY }} | |
image: ${{ needs.builder.outputs.builder_image }} | |
options: --platform=linux/arm64 -v ${{ github.workspace }}/sysdig:/source/sysdig -v ${{ github.workspace }}/sysdig-build-aarch64:/build/dev-packages -v ${{ github.workspace }}/skeleton-build:/build-skeleton | |
run: | | |
mkdir -p /build/dev-packages && \ | |
build cmake && \ | |
build package && \ | |
cp /build/release/sysdig-* /build/dev-packages | |
- name: Upload deb package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sysdig-dev-linux-aarch64.deb | |
path: | | |
${{ github.workspace }}/sysdig-build-aarch64/sysdig-*.deb | |
- name: Upload rpm package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sysdig-dev-linux-aarch64.rpm | |
path: | | |
${{ github.workspace }}/sysdig-build-aarch64/sysdig-*.rpm | |
- name: Upload tar.gz package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sysdig-dev-linux-aarch64.tar.gz | |
path: | | |
${{ github.workspace }}/sysdig-build-aarch64/sysdig-*.tar.gz | |
build-sysdig-others-amd64: | |
name: build-sysdig-other-amd64 | |
strategy: | |
matrix: | |
os: [windows-latest, macos-latest] | |
include: | |
- os: windows-latest | |
artifact_name: win | |
artifact_ext: exe | |
- os: macos-latest | |
artifact_name: osx | |
artifact_ext: dmg | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout Sysdig | |
uses: actions/checkout@v3 | |
- name: Build | |
run: | | |
mkdir -p build | |
cd build && cmake -Wno-dev -DBUILD_DRIVER=OFF .. | |
cmake --build . --target package --config Release | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sysdig-dev-${{ matrix.artifact_name }}-x86_64.${{ matrix.artifact_ext }} | |
path: | | |
build/sysdig-*.${{ matrix.artifact_ext }} |