Fix get ref #307
Workflow file for this run
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: "Build Docker Image for conductor testing" | |
concurrency: | |
group: "conductor-${{ github.ref }}" | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- staging | |
tags: | |
- '*' | |
pull_request: | |
workflow_dispatch: | |
env: | |
BLOBBER_REGISTRY: ${{ secrets.BLOBBER_REGISTRY }} | |
DOCKER_CLI_EXPERIMENTAL: enabled | |
jobs: | |
build_blobber_for_conductor_testing: | |
runs-on: [self-hosted, arc-runner] | |
steps: | |
- name: Set docker image tag | |
run: | | |
if [[ "${{github.ref}}" == refs/pull/* ]]; then | |
tag=${GITHUB_REF/\/merge/} | |
echo "TAG=$(echo pr-${tag:10})" >> $GITHUB_ENV | |
else | |
echo "TAG=$(echo ${GITHUB_REF#refs/*/} | sed 's/\//-/g')" >> $GITHUB_ENV | |
fi | |
echo "BRANCH=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo ${GITHUB_REF#refs/*/} || echo $GITHUB_HEAD_REF)" >> $GITHUB_ENV | |
echo "SHA=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo $GITHUB_SHA || echo '${{ github.event.pull_request.head.sha }}')" >> $GITHUB_ENV | |
- name: Setup go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ^1.20 # The Go version to download (if necessary) and use. | |
- name: Clone blobber | |
uses: actions/checkout@v1 | |
- name: Set up Docker Buildx | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install wget | |
sudo apt-get install ca-certificates curl gnupg lsb-release -y | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
sudo apt-get update -y | |
sudo apt-get install docker-ce docker-ce-cli containerd.io -y | |
export DOCKER_CLI_EXPERIMENTAL=enabled | |
docker run --privileged --rm tonistiigi/binfmt --install all | |
docker context create blobber_buildx | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Testing blobber & validator builds for conductor testing | |
run: | | |
SHORT_SHA=$(echo ${{ env.SHA }} | head -c 8) | |
# export DOCKER_IMAGE_BASE="${BLOBBER_REGISTRY}:base" | |
# export DOCKER_IMAGE_SWAGGER="${BLOBBER_REGISTRY}:swagger_test" | |
# export DOCKER_BUILD="buildx build --platform linux/amd64,linux/arm64 --push" | |
# export DOCKER_IMAGE_BLOBBER="-t ${BLOBBER_REGISTRY}:${TAG} -t ${BLOBBER_REGISTRY}:${TAG}-${SHORT_SHA}" | |
docker buildx create --driver-opt network=host --use --buildkitd-flags '--allow-insecure-entitlement security.insecure' --use blobber_buildx | |
./docker.local/bin/build.base.sh && ./docker.local/bin/build.blobber-integration-tests.sh |