Files
kata-containers/.github/workflows/main.yaml
Eric Ernst fc3cc6e3c2 workflows: add release workflow
Many changes introduced by Archana Shinde.

This workflow will:
 1. get a list of artifacts from the packaging repo
 2. In parallel, build each of the applicable artifacts
 3. Consolidate the build artifacts from <2>
 4. Test the artifacts in a docker image on AKS
 5. Push the verified docker image to dockerhub

Status:
 - needs snap support (todo: Julio)
 - needs support for pushing to GH releases page (todo:Carlos)
 - needs to use kata-containers branches of packaging once the
prerequisite commits land there (todo: Eric
 - should push to katacontainers dockerhub, once flow is verified (todo:
Eric)
 - needs secrets added to kata-containers/kata-containers, once we are
ready to merge there (todo: Eric)

Signed-off-by: Eric Ernst <eric.ernst@intel.com>
2019-11-13 09:30:21 -08:00

344 lines
12 KiB
YAML

on:
push:
tags:
- '*'
jobs:
get-artifact-list:
runs-on: ubuntu-latest
steps:
- name: get the list
run: |
git clone https://github.com/kata-containers/packaging
pushd kata-packaging
tag=`echo $GITHUB_REF | cut -d/ -f3-`
git checkout $tag
popd
./kata-packaging/artifact-list.sh > artifact-list.txt
- name: save-artifact-list
uses: actions/upload-artifact@master
with:
name: artifact-list
path: artifact-list.txt
build-kernel:
runs-on: ubuntu-16.04
needs: get-artifact-list
steps:
- name: get-artifact-list
uses: actions/download-artifact@master
with:
name: artifact-list
- name: build-kernel
run: |
if grep -q "install_kernel" ./artifact-list/artifact-list.txt; then
# install kernel dependencies
sudo apt-get update && sudo apt install -y flex bison libelf-dev bc iptables
export GOPATH=$HOME/go
go get github.com/kata-containers/packaging || true
pushd $GOPATH/src/github.com/kata-containers/packaging/release >>/dev/null
# Get versions information
tag=`echo $GITHUB_REF | cut -d/ -f3-`
git checkout $tag
pushd ../obs-packaging
./gen_versions_txt.sh $tag
popd
# Build the kernel:
source ./kata-deploy-binaries.sh
install_kernel
echo ::set-env name=artifact-built::true
popd >>/dev/null
mv $HOME/go/src/github.com/kata-containers/packaging/release/kata-kernel.tar.gz .
else
echo ::set-env name=artifact-built::false
fi
- name: store-artifacts
if: env.artifact-built == 'true'
uses: actions/upload-artifact@master
with:
name: kata-artifacts
path: kata-kernel.tar.gz
build-experimental-kernel:
runs-on: ubuntu-16.04
needs: get-artifact-list
steps:
- name: get-artifact-list
uses: actions/download-artifact@master
with:
name: artifact-list
- name: build-experimental-kernel
run: |
if grep -q "install_experimental_kernel" ./artifact-list/artifact-list.txt; then
# install kernel dependencies
sudo apt-get update && sudo apt install -y flex bison libelf-dev bc iptables
export GOPATH=$HOME/go
go get github.com/kata-containers/packaging || true
pushd $GOPATH/src/github.com/kata-containers/packaging/release >>/dev/null
# Get versions information
tag=`echo $GITHUB_REF | cut -d/ -f3-`
git checkout $tag
../obs-packaging/gen_versions_txt.sh $tag
# Build the kernel:
source ./kata-deploy-binaries.sh
install_experimental_kernel
echo ::set-env name=artifact-built::true
popd >>/dev/null
mv $HOME/go/src/github.com/kata-containers/packaging/release/kata-kernel-experimental.tar.gz .
else
echo ::set-env name=artifact-built::false
fi
- name: store-artifacts
if: env.artifact-built == 'true'
uses: actions/upload-artifact@master
with:
name: kata-artifacts
path: kata-kernel-experimental.tar.gz
# Job for building the QEMU binaries
build-qemu:
runs-on: ubuntu-16.04
needs: get-artifact-list
steps:
- name: get-artifact-list
uses: actions/download-artifact@master
with:
name: artifact-list
- name: build-qemu
run: |
if grep -q "install_qemu" ./artifact-list/artifact-list.txt; then
export GOPATH=$HOME/go
go get github.com/kata-containers/packaging || true
pushd $GOPATH/src/github.com/kata-containers/packaging/release >>/dev/null
# Get versions information
tag=`echo $GITHUB_REF | cut -d/ -f3-`
git checkout $tag
../obs-packaging/gen_versions_txt.sh $tag
# Build the VMM:
source ./kata-deploy-binaries.sh
install_qemu
echo ::set-env name=artifact-built::true
popd >>/dev/null
mv $HOME/go/src/github.com/kata-containers/packaging/release/kata-qemu-static.tar.gz .
else
echo ::set-env name=artifact-built::false
fi
- name: store-artifacts
if: env.artifact-built == 'true'
uses: actions/upload-artifact@master
with:
name: kata-artifacts
path: kata-qemu-static.tar.gz
# Job for building the QEMU binaries with virtiofs support
build-qemu-virtiofsd:
runs-on: ubuntu-16.04
needs: get-artifact-list
steps:
- name: get-artifact-list
uses: actions/download-artifact@master
with:
name: artifact-list
- name: build-qemu-virtiofsd
run: |
if grep -q "install_qemu_virtiofsd" ./artifact-list/artifact-list.txt; then
export GOPATH=$HOME/go
go get github.com/kata-containers/packaging || true
pushd $GOPATH/src/github.com/kata-containers/packaging/release >>/dev/null
# Get versions information
tag=`echo $GITHUB_REF | cut -d/ -f3-`
git checkout $tag
../obs-packaging/gen_versions_txt.sh $tag
# Build the VMM:
source ./kata-deploy-binaries.sh
install_qemu_virtiofsd
echo ::set-env name=artifact-built::true
popd >>/dev/null
mv $HOME/go/src/github.com/kata-containers/packaging/release/kata-qemu-virtiofs-static.tar.gz .
else
echo ::set-env name=artifact-built::false
fi
- name: store-artifacts
if: env.artifact-built == 'true'
uses: actions/upload-artifact@master
with:
name: kata-artifacts
path: kata-qemu-virtiofs-static.tar.gz
# Job for building the image
build-image:
runs-on: ubuntu-16.04
needs: get-artifact-list
steps:
- name: get-artifact-list
uses: actions/download-artifact@master
with:
name: artifact-list
- name: build-image
run: |
if grep -q "install_image" ./artifact-list/artifact-list.txt; then
export GOPATH=$HOME/go
go get github.com/kata-containers/packaging || true
pushd $GOPATH/src/github.com/kata-containers/packaging/release >>/dev/null
# Get versions information
tag=`echo $GITHUB_REF | cut -d/ -f3-`
git checkout $tag
pushd ../obs-packaging
./gen_versions_txt.sh $tag
popd
# Build the VMM:
source ./kata-deploy-binaries.sh
install_image $tag
echo ::set-env name=artifact-built::true
popd >>/dev/null
mv $HOME/go/src/github.com/kata-containers/packaging/release/kata-image.tar.gz .
else
echo ::set-env name=artifact-built::false
fi
- name: store-artifacts
if: env.artifact-built == 'true'
uses: actions/upload-artifact@master
with:
name: kata-artifacts
path: kata-image.tar.gz
# Job for building firecracker hypervisor
build-firecracker:
runs-on: ubuntu-16.04
needs: get-artifact-list
steps:
- name: get-artifact-list
uses: actions/download-artifact@master
with:
name: artifact-list
- name: build-firecracker
run: |
if grep -q "install_firecracker" ./artifact-list/artifact-list.txt; then
export GOPATH=$HOME/go
go get github.com/kata-containers/packaging || true
pushd $GOPATH/src/github.com/kata-containers/packaging/release >>/dev/null
# Get versions information
tag=`echo $GITHUB_REF | cut -d/ -f3-`
git checkout $tag
../obs-packaging/gen_versions_txt.sh $tag
# Build the VMM:
source ./kata-deploy-binaries.sh
install_firecracker
echo ::set-env name=artifact-built::true
popd >>/dev/null
mv $HOME/go/src/github.com/kata-containers/packaging/release/kata-firecracker-static.tar.gz .
else
echo ::set-env name=artifact-built::false
fi
- name: store-artifacts
if: env.artifact-built == 'true'
uses: actions/upload-artifact@master
with:
name: kata-artifacts
path: kata-firecracker-static.tar.gz
# Job for building kata components
build-kata-components:
runs-on: ubuntu-16.04
needs: get-artifact-list
steps:
- name: get-artifact-list
uses: actions/download-artifact@master
with:
name: artifact-list
- name: build-kata-components
run: |
if grep -q "install_kata_components" ./artifact-list/artifact-list.txt; then
export GOPATH=$HOME/go
go get github.com/kata-containers/packaging || true
pushd $GOPATH/src/github.com/kata-containers/packaging/release >>/dev/null
# Get versions information
tag=`echo $GITHUB_REF | cut -d/ -f3-`
git checkout $tag
../obs-packaging/gen_versions_txt.sh $tag
# Build the VMM:
source ./kata-deploy-binaries.sh
install_kata_components $tag
echo ::set-env name=artifact-built::true
popd >>/dev/null
mv $HOME/go/src/github.com/kata-containers/packaging/release/kata-components.tar.gz .
else
echo ::set-env name=artifact-built::false
fi
- name: store-artifacts
if: env.artifact-built == 'true'
uses: actions/upload-artifact@master
with:
name: kata-artifacts
path: kata-components.tar.gz
gather-artifacts:
runs-on: ubuntu-16.04
needs: [build-kernel, build-qemu, build-qemu-virtiofsd, build-image, build-firecracker, build-kata-components]
steps:
- name: get-artifacts
uses: actions/download-artifact@master
with:
name: kata-artifacts
- name: colate-artifacts
run: |
export GOPATH=$HOME/go
go get github.com/kata-containers/packaging || true
pushd $GOPATH/src/github.com/kata-containers/packaging/release >>/dev/null
# Get versions information
tag=`echo $GITHUB_REF | cut -d/ -f3-`
popd >>/dev/null
pushd kata-artifacts >>/dev/null
for c in ./*.tar.gz
do
echo "untarring tarball $c"
tar -xvf $c
done
ls ./opt/kata/bin
ls ./opt/kata/share
tar cfJ ../kata-static.tar.xz ./opt
popd >>/dev/null
ls -l && ls kata-artifacts
- name: store-artifacts
uses: actions/upload-artifact@master
with:
name: release-candidate
path: kata-static.tar.xz
kata-deploy:
needs: gather-artifacts
runs-on: ubuntu-latest
steps:
- name: get-artifacts
uses: actions/download-artifact@master
with:
name: release-candidate
- name: build-and-push-kata-deploy-ci
run: |
tag=`echo $GITHUB_REF | cut -d/ -f3-`
git clone https://github.com/kata-containers/packaging
pushd kata-packaging
git checkout $tag
pkg_sha=$(git rev-parse HEAD)
popd
mv release-candidate/kata-static.tar.xz ./kata-packaging/kata-deploy/kata-static.tar.xz
docker build --build-arg KATA_ARTIFACTS=kata-static.tar.xz -t katadocker/kata-deploy-ci:$pkg_sha ./kata-packaging/kata-deploy
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker push katadocker/kata-deploy-ci:$pkg_sha
echo ::set-env name=PKG_SHA::$pkg_sha
echo ::set-env name=TAG::$tag
- name: test-kata-deploy-ci-in-aks
uses: ./kata-packaging/kata-deploy/action
with:
packaging-sha: env.PKG_SHA
env:
PKG_SHA: ${{ env.PKG_SHA }}
AZ_APPID: ${{ secrets.AZ_APPID }}
AZ_PASSWORD: ${{ secrets.AZ_PASSWORD }}
AZ_SUBSCRIPTION_ID: ${{ secrets.AZ_SUBSCRIPTION_ID }}
AZ_TENANT_ID: ${{ secrets.AZ_TENANT_ID }}
- name: push-tarball
run: |
# tag the container image we created and push to DockerHub
docker tag katadocker/kata-deploy-ci:${{ env.PKG_SHA }} katadocker/kata-deploy:${{ env.TAG }}
docker push katadocker/kata-deploy:${{ env.TAG }}