forked from kata-containers/kata-containers
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
github: add workflows for building and publishing kata artifacts on p…
…pc64le Adds workflows for building kata static tarball and releasing it. Fixes: kata-containers#8458 Signed-off-by: Amulyam24 <[email protected]>
- Loading branch information
Showing
6 changed files
with
305 additions
and
5 deletions.
There are no files selected for viewing
116 changes: 116 additions & 0 deletions
116
.github/workflows/build-kata-static-tarball-ppc64le.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
name: CI | Build kata-static tarball for ppc64le | ||
on: | ||
workflow_call: | ||
inputs: | ||
stage: | ||
required: false | ||
type: string | ||
default: test | ||
tarball-suffix: | ||
required: false | ||
type: string | ||
push-to-registry: | ||
required: false | ||
type: string | ||
default: no | ||
commit-hash: | ||
required: false | ||
type: string | ||
target-branch: | ||
required: false | ||
type: string | ||
default: "" | ||
|
||
jobs: | ||
build-asset: | ||
runs-on: ppc64le | ||
strategy: | ||
matrix: | ||
asset: | ||
- kernel | ||
- qemu | ||
- rootfs-initrd | ||
- shim-v2 | ||
- virtiofsd | ||
stage: | ||
- ${{ inputs.stage }} | ||
steps: | ||
- name: Adjust a permission for repo | ||
run: | | ||
sudo chown -R $USER:$USER $GITHUB_WORKSPACE | ||
- name: Login to Kata Containers quay.io | ||
if: ${{ inputs.push-to-registry == 'yes' }} | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_DEPLOYER_USERNAME }} | ||
password: ${{ secrets.QUAY_DEPLOYER_PASSWORD }} | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.commit-hash }} | ||
fetch-depth: 0 # This is needed in order to keep the commit ids history | ||
|
||
- name: Rebase atop of the latest target branch | ||
run: | | ||
./tests/git-helper.sh "rebase-atop-of-the-latest-target-branch" | ||
env: | ||
TARGET_BRANCH: ${{ inputs.target-branch }} | ||
|
||
- name: Build ${{ matrix.asset }} | ||
run: | | ||
CROSS_BUILD=true ARCH=ppc64le TARGET_ARCH=ppc64le make "${KATA_ASSET}-tarball" | ||
build_dir=$(readlink -f build) | ||
# store-artifact does not work with symlink | ||
sudo cp -r "${build_dir}" "kata-build" | ||
sudo chown -R $(id -u):$(id -g) "kata-build" | ||
env: | ||
KATA_ASSET: ${{ matrix.asset }} | ||
TAR_OUTPUT: ${{ matrix.asset }}.tar.gz | ||
PUSH_TO_REGISTRY: ${{ inputs.push-to-registry }} | ||
ARTEFACT_REGISTRY: ghcr.io | ||
ARTEFACT_REGISTRY_USERNAME: ${{ github.actor }} | ||
ARTEFACT_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | ||
TARGET_BRANCH: ${{ inputs.target-branch }} | ||
|
||
- name: store-artifact ${{ matrix.asset }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: kata-artifacts-ppc64le${{ inputs.tarball-suffix }} | ||
path: kata-build/kata-static-${{ matrix.asset }}.tar.xz | ||
retention-days: 1 | ||
if-no-files-found: error | ||
|
||
create-kata-tarball: | ||
runs-on: ubuntu-latest | ||
needs: build-asset | ||
steps: | ||
- name: Adjust a permission for repo | ||
run: | | ||
sudo chown -R $USER:$USER $GITHUB_WORKSPACE | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.commit-hash }} | ||
fetch-depth: 0 | ||
- name: Rebase atop of the latest target branch | ||
run: | | ||
./tests/git-helper.sh "rebase-atop-of-the-latest-target-branch" | ||
env: | ||
TARGET_BRANCH: ${{ inputs.target-branch }} | ||
- name: get-artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: kata-artifacts-ppc64le${{ inputs.tarball-suffix }} | ||
path: kata-artifacts | ||
- name: merge-artifacts | ||
run: | | ||
./tools/packaging/kata-deploy/local-build/kata-deploy-merge-builds.sh kata-artifacts versions.yaml | ||
- name: store-artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: kata-static-tarball-ppc64le${{ inputs.tarball-suffix }} | ||
path: kata-static.tar.xz | ||
retention-days: 1 | ||
if-no-files-found: error |
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
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
70 changes: 70 additions & 0 deletions
70
.github/workflows/publish-kata-deploy-payload-ppc64le.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: CI | Publish kata-deploy payload for ppc64le | ||
on: | ||
workflow_call: | ||
inputs: | ||
tarball-suffix: | ||
required: false | ||
type: string | ||
registry: | ||
required: true | ||
type: string | ||
repo: | ||
required: true | ||
type: string | ||
tag: | ||
required: true | ||
type: string | ||
commit-hash: | ||
required: false | ||
type: string | ||
target-branch: | ||
required: false | ||
type: string | ||
default: "" | ||
|
||
jobs: | ||
kata-payload: | ||
runs-on: ppc64le | ||
steps: | ||
- name: Adjust a permission for repo | ||
run: | | ||
sudo chown -R $USER:$USER $GITHUB_WORKSPACE | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.commit-hash }} | ||
fetch-depth: 0 | ||
|
||
- name: Rebase atop of the latest target branch | ||
run: | | ||
./tests/git-helper.sh "rebase-atop-of-the-latest-target-branch" | ||
env: | ||
TARGET_BRANCH: ${{ inputs.target-branch }} | ||
|
||
- name: get-kata-tarball | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: kata-static-tarball-ppc64le${{ inputs.tarball-suffix }} | ||
|
||
- name: Login to Kata Containers quay.io | ||
if: ${{ inputs.registry == 'quay.io' }} | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_DEPLOYER_USERNAME }} | ||
password: ${{ secrets.QUAY_DEPLOYER_PASSWORD }} | ||
|
||
- name: Login to Kata Containers ghcr.io | ||
if: ${{ inputs.registry == 'ghcr.io' }} | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: build-and-push-kata-payload | ||
id: build-and-push-kata-payload | ||
run: | | ||
./tools/packaging/kata-deploy/local-build/kata-deploy-build-and-upload-payload.sh \ | ||
$(pwd)/kata-static.tar.xz \ | ||
${{ inputs.registry }}/${{ inputs.repo }} ${{ inputs.tag }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Publish Kata release artifacts for ppc64le | ||
on: | ||
workflow_call: | ||
inputs: | ||
target-arch: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
build-kata-static-tarball-ppc64le: | ||
uses: ./.github/workflows/build-kata-static-tarball-ppc64le.yaml | ||
with: | ||
stage: release | ||
|
||
kata-deploy: | ||
needs: build-kata-static-tarball-ppc64le | ||
runs-on: ppc64le | ||
steps: | ||
- name: Login to Kata Containers docker.io | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Login to Kata Containers quay.io | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_DEPLOYER_USERNAME }} | ||
password: ${{ secrets.QUAY_DEPLOYER_PASSWORD }} | ||
|
||
- uses: actions/checkout@v4 | ||
- name: get-kata-tarball | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: kata-static-tarball-ppc64le | ||
|
||
- name: build-and-push-kata-deploy-ci-ppc64le | ||
id: build-and-push-kata-deploy-ci-ppc64le | ||
run: | | ||
# We need to do such trick here as the format of the $GITHUB_REF | ||
# is "refs/tags/<tag>" | ||
tag=$(echo $GITHUB_REF | cut -d/ -f3-) | ||
tags=($tag) | ||
tags+=($([[ "$tag" =~ "alpha"|"rc" ]] && echo "latest" || echo "stable")) | ||
for tag in ${tags[@]}; do | ||
./tools/packaging/kata-deploy/local-build/kata-deploy-build-and-upload-payload.sh \ | ||
$(pwd)/kata-static.tar.xz "docker.io/katadocker/kata-deploy" \ | ||
"${tag}-${{ inputs.target-arch }}" | ||
./tools/packaging/kata-deploy/local-build/kata-deploy-build-and-upload-payload.sh \ | ||
$(pwd)/kata-static.tar.xz "quay.io/kata-containers/kata-deploy" \ | ||
"${tag}-${{ inputs.target-arch }}" | ||
done |
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