[deps]: Update go minor #17
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 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@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.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@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 | |
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@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 # v6.5.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 |