Skip to content

Update docker/build-push-action action to v6 #1163

Update docker/build-push-action action to v6

Update docker/build-push-action action to v6 #1163

Workflow file for this run

name: Build Training and Publish
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
-
name: Set up npm for linting
uses: actions/setup-node@v4
with:
node-version: '18.x'
-
name: Lint Markdown
run: npm ci && npm run mdlint
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to quay.io acend organization
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_TOKEN }}
-
name: Build Acend Version
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: |
quay.io/acend/kubernetes-basics-training:pr-${{ github.event.pull_request.number }}
-
name: Build Mobi Version
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
build-args: |
TRAINING_HUGO_ENV=mobi
push: true
tags: |
quay.io/acend/kubernetes-basics-training:pr-${{ github.event.pull_request.number }}-mobi
-
name: Build OpenShift Version
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
build-args: |
TRAINING_HUGO_ENV=openshift
push: true
tags: |
quay.io/acend/kubernetes-basics-training:pr-${{ github.event.pull_request.number }}-openshift
-
name: Build Baloise Version
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
build-args: |
TRAINING_HUGO_ENV=baloise
push: true
tags: |
quay.io/acend/kubernetes-basics-training:pr-${{ github.event.pull_request.number }}-baloise
-
name: Build SBB Version
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
build-args: |
TRAINING_HUGO_ENV=sbb
push: true
tags: |
quay.io/acend/kubernetes-basics-training:pr-${{ github.event.pull_request.number }}-sbb
-
name: Build BFH Version
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
build-args: |
TRAINING_HUGO_ENV=bfh
push: true
tags: |
quay.io/acend/kubernetes-basics-training:pr-${{ github.event.pull_request.number }}-bfh
-
name: Login to quay.io appuio organization
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAYIO_USERNAME_TECHLAB }}
password: ${{ secrets.QUAYIO_TOKEN_TECHLAB }}
-
name: Build techlab version
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
build-args: |
TRAINING_HUGO_ENV=techlab
push: true
tags: |
quay.io/appuio/techlab:pr-${{ github.event.pull_request.number }}
-
name: 'Install Helm'
uses: azure/setup-helm@v4
with:
version: v3.6.2
-
name: Install Kubectl
uses: azure/setup-kubectl@v4
with:
version: v1.21.2
-
name: Create KUBECONFIG
env:
KUBE_CONFIG: '${{ secrets.KUBECONFIG_K8S_ACEND_TEST }}'
run: |
mkdir -p $HOME/.kube
echo "$KUBE_CONFIG" > $HOME/.kube/config
-
name: Deploy Helm Release
env:
TRAINING_HELM_RELEASE: 'pr-${{ github.event.pull_request.number }}'
TRAINING_NAMESPACE: 'acend-kubernetes-basics-training-test'
TRAINING_VERSION: '${{ github.sha }}'
run: |
helm upgrade $TRAINING_HELM_RELEASE acend-training-chart --install --wait --kubeconfig $HOME/.kube/config --namespace=$TRAINING_NAMESPACE --set=app.name=$HELM_RELEASE --set=app.version=$TRAINING_VERSION --repo=https://acend.github.io/helm-charts/ --values=helm-chart/values.yaml --atomic
-
name: Redeploy Deployments
env:
TRAINING_HELM_RELEASE: 'pr-${{ github.event.pull_request.number }}'
TRAINING_HELM_NAME: 'acend-kubernetes-basics'
TRAINING_NAMESPACE: 'acend-kubernetes-basics-training-test'
run: |
kubectl rollout restart deployment/${TRAINING_HELM_RELEASE}-${TRAINING_HELM_NAME}-acend --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE
kubectl rollout restart deployment/${TRAINING_HELM_RELEASE}-${TRAINING_HELM_NAME}-mobi --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE
kubectl rollout restart deployment/${TRAINING_HELM_RELEASE}-${TRAINING_HELM_NAME}-openshift --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE
kubectl rollout restart deployment/${TRAINING_HELM_RELEASE}-${TRAINING_HELM_NAME}-baloise --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE
kubectl rollout restart deployment/${TRAINING_HELM_RELEASE}-${TRAINING_HELM_NAME}-sbb --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE
kubectl rollout restart deployment/${TRAINING_HELM_RELEASE}-${TRAINING_HELM_NAME}-bfh --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE
kubectl rollout restart deployment/${TRAINING_HELM_RELEASE}-${TRAINING_HELM_NAME}-techlab --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE
-
name: Comment PR Environments in PR
uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message: |
PR environments:
* [acend](https://kubernetes-basics-pr-${{ github.event.pull_request.number }}.training.acend.ch)
* [Mobi](https://kubernetes-basics-mobi-pr-${{ github.event.pull_request.number }}.training.puzzle.ch)
* [OpenShift](https://openshift-basics-pr-${{ github.event.pull_request.number }}.training.acend.ch)
* [OpenShift Baloise](https://openshift-basics-baloise-pr-${{ github.event.pull_request.number }}.training.acend.ch)
* [OpenShift SBB](https://openshift-basics-sbb-pr-${{ github.event.pull_request.number }}.training.acend.ch)
* [OpenShift BFH](https://openshift-basics-bfh-pr-${{ github.event.pull_request.number }}.training.acend.ch)
* [APPUiO Techlab](https://techlab-pr-${{ github.event.pull_request.number }}.training.acend.ch)