MDBF-832 & MDBF-828 - Prepare BBM deployment for Production #143
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: bbm-build-container | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- "Dockerfile" | |
- .github/workflows/bbm_build_container.yml | |
pull_request: | |
paths: | |
- "Dockerfile" | |
- .github/workflows/bbm_build_container.yml | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
name: build | |
services: | |
registry: | |
image: registry:2 | |
ports: | |
- 5000:5000 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check Dockerfile with hadolint | |
run: | | |
docker run -i -v $(pwd):/mnt -w /mnt ghcr.io/hadolint/hadolint:latest hadolint /mnt/Dockerfile | |
- name: Set up env vars | |
run: | | |
echo "REPO=bb-master" >>$GITHUB_ENV | |
- name: Build master image | |
run: | | |
podman build . --tag ${{ env.REPO }}:master | |
- name: Build master-web image | |
run: | | |
podman build . --tag ${{ env.REPO }}:master-web \ | |
--build-arg master_type=master-web | |
- name: Push images to local registry | |
run: | | |
for img in master master-web; do | |
podman push --tls-verify=0 \ | |
${{ env.REPO }}:$img \ | |
docker://localhost:5000/${{ env.REPO }}:$img | |
done | |
- name: Check images | |
run: | | |
docker run -i localhost:5000/${{ env.REPO }}:master buildbot --version | |
#//TEMP there is probably a better way for master-web here | |
docker run -i localhost:5000/${{ env.REPO }}:master-web buildbot --version | |
- name: Check for registry credentials | |
if: > | |
github.ref == 'refs/heads/dev' && | |
github.repository == 'MariaDB/buildbot' | |
run: | | |
missing=() | |
[[ -n "${{ secrets.QUAY_USER }}" ]] || missing+=(QUAY_USER) | |
[[ -n "${{ secrets.QUAY_TOKEN }}" ]] || missing+=(QUAY_TOKEN) | |
for i in "${missing[@]}"; do | |
echo "Missing github secret: $i" | |
done | |
if (( ${#missing[@]} == 0 )); then | |
echo "DEPLOY_IMAGES=true" >> $GITHUB_ENV | |
else | |
echo "Not pushing images to registry" | |
fi | |
- name: Login to ghcr.io | |
if: ${{ env.DEPLOY_IMAGES == 'true' }} | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push images to ghcr.io | |
if: ${{ env.DEPLOY_IMAGES == 'true' }} | |
run: | | |
msg="Push docker images to ghcr.io" | |
line="${msg//?/=}" | |
printf "\n${line}\n${msg}\n${line}\n" | |
for image in master master-web; do | |
skopeo copy --all --src-tls-verify=0 \ | |
docker://localhost:5000/${{ env.REPO }}:${image} \ | |
docker://ghcr.io/mariadb/buildbot:dev_${image} | |
done | |
- name: Login to quay.io | |
if: ${{ env.DEPLOY_IMAGES == 'true' }} | |
uses: docker/login-action@v2 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USER }} | |
password: ${{ secrets.QUAY_TOKEN }} | |
- name: Push images to quay.io | |
if: ${{ env.DEPLOY_IMAGES == 'true' }} | |
run: | | |
msg="Push docker images to quay.io" | |
line="${msg//?/=}" | |
printf "\n${line}\n${msg}\n${line}\n" | |
for image in master master-web; do | |
skopeo copy --all --src-tls-verify=0 \ | |
docker://localhost:5000/${{ env.REPO }}:${image} \ | |
docker://quay.io/mariadb-foundation/${{ env.REPO }}:dev_${image} | |
done |