Skip to content

[deps]: Update docker/setup-buildx-action digest to 4fd8129 #6

[deps]: Update docker/setup-buildx-action digest to 4fd8129

[deps]: Update docker/setup-buildx-action digest to 4fd8129 #6

Workflow file for this run

name: Build for GitHub Container Registry
on:
push:
workflow_dispatch:
jobs:
build-docker:
name: Build Docker images
runs-on: ubuntu-22.04
env:
_GHCR_REGISTRY: ghcr.io/bitwarden
_PROJECT_NAME: sm-operator
steps:
- name: Check out repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 #v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Test operator
id: test
run: |
sudo apt update && sudo apt install musl-tools -y
make setup
make test
- name: Upload to codecov.io
uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # v4.4.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Generate Docker image tag
id: tag
run: |
IMAGE_TAG=$(echo "${GITHUB_REF:11}" | sed "s#/#-#g") # slash safe branch name
if [[ "$IMAGE_TAG" == "main" ]]; then
IMAGE_TAG=dev
fi
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Generate image full name
id: image-name
env:
IMAGE_TAG: ${{ steps.tag.outputs.image_tag }}
run: echo "name=${_GHCR_REGISTRY}/${_PROJECT_NAME}:${IMAGE_TAG}" >> $GITHUB_OUTPUT
- name: Build Docker image
uses: docker/build-push-action@31159d49c0d4756269a0940a750801a1ea5d7003 # v6.1.0
with:
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.image-name.outputs.name }}
- name: Create kind cluster
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
- name: Smoke test image
id: smoke-test
env:
IMAGE: ${{ steps.image-name.outputs.name }}
run: |
make deploy IMG=$IMAGE
count=0
while [[ $(kubectl get pods -n sm-operator-system -l control-plane=controller-manager -o jsonpath="{.items[*].status.containerStatuses[*].ready}") != "true" ]]; do
sleep 1;
count=$count+1
if [[ count -ge 30 ]]; then
break
fi
done
#For review purposes
echo "*****DEPLOYMENTS*****"
kubectl get deployments -n sm-operator-system
echo "*****PODS*****"
pods=$(kubectl get pods -n sm-operator-system -l control-plane=controller-manager | grep 2/2)
echo $pods
if [[ -z "$pods" ]]; then
echo "::error::No pods found."
exit 1
fi
echo "*****OPERATOR OK*****"
- name: Clean up
run: |
make undeploy
kind delete cluster