constellation/.github/workflows/build-ccm-gcp.yml
Fabian Kammel 582412d275
Fix GCP CCM build, add v26, and exclude old broken versions until fixed. (#1038)
Signed-off-by: Fabian Kammel <fk@edgeless.systems>
2023-01-20 15:17:00 +01:00

74 lines
2.6 KiB
YAML

name: Build and Upload GCP CCM container image
env:
REGISTRY: ghcr.io
on: [workflow_dispatch]
jobs:
build-ccm-gcp:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
strategy:
matrix:
version: [v26.0.1]
# TODO: Once issue is closed upgrade older versions, rebuild, and update versions.go
# https://github.com/kubernetes/cloud-provider-gcp/issues/451
# version: [v26.0.1, v25.5.0, v24.0.0]
include:
- version: v26.0.1
latest: true
steps:
- name: Checkout kubernetes/cloud-provider-gcp
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
repository: "kubernetes/cloud-provider-gcp"
ref: refs/tags/ccm/${{ matrix.version }}
- name: Docker meta
id: meta
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 # v4.3.0
with:
images: |
${{ env.REGISTRY }}/edgelesssys/cloud-provider-gcp
flavor: |
latest=${{ matrix.latest || false }}
tags: |
type=semver,pattern=v{{version}},value=${{ matrix.version }}
type=semver,pattern=v{{major}}.{{minor}},value=${{ matrix.version }}
type=semver,pattern=v{{major}},value=${{ matrix.version }}
- name: Log in to the Container registry
id: docker-login
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # tag=v2.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build CCM
run: |
bazelisk build //cmd/cloud-controller-manager:cloud-controller-manager
- name: Copy CCM
run: |
# support new and old bazel output paths
cp ./bazel-bin/cmd/cloud-controller-manager/cloud-controller-manager_/cloud-controller-manager ./cloud-controller-manager || \
cp ./bazel-bin/cmd/cloud-controller-manager/linux_amd64_pure_stripped/cloud-controller-manager ./cloud-controller-manager
- name: Prepare Dockerfile
run: |
cat > Dockerfile <<EOF
FROM scratch
COPY ./cloud-controller-manager /cloud-controller-manager
EOF
- name: Build and push container image
id: build
uses: docker/build-push-action@37abcedcc1da61a57767b7588cb9d03eb57e28b3 # v3.3.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}