2022-08-03 05:46:11 -04:00
|
|
|
name: Build and Upload GCP CCM container image
|
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
|
|
|
on: [workflow_dispatch]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-ccm-gcp:
|
2022-11-10 10:55:24 -05:00
|
|
|
runs-on: ubuntu-22.04
|
2022-08-03 05:46:11 -04:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-01-20 09:17:00 -05:00
|
|
|
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]
|
2022-08-03 05:46:11 -04:00
|
|
|
include:
|
2023-01-20 09:17:00 -05:00
|
|
|
- version: v26.0.1
|
2022-08-03 05:46:11 -04:00
|
|
|
latest: true
|
|
|
|
steps:
|
2023-01-18 04:15:58 -05:00
|
|
|
- name: Checkout kubernetes/cloud-provider-gcp
|
2023-04-03 10:36:43 -04:00
|
|
|
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
|
2022-08-03 05:46:11 -04:00
|
|
|
with:
|
2022-09-02 11:00:29 -04:00
|
|
|
repository: "kubernetes/cloud-provider-gcp"
|
2022-08-03 05:46:11 -04:00
|
|
|
ref: refs/tags/ccm/${{ matrix.version }}
|
|
|
|
|
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
2023-01-18 11:04:46 -05:00
|
|
|
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 # v4.3.0
|
2022-08-03 05:46:11 -04:00
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
${{ env.REGISTRY }}/edgelesssys/cloud-provider-gcp
|
|
|
|
flavor: |
|
|
|
|
latest=${{ matrix.latest || false }}
|
|
|
|
tags: |
|
2022-09-02 11:00:29 -04:00
|
|
|
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 }}
|
2022-09-14 09:14:26 -04:00
|
|
|
|
2022-08-03 05:46:11 -04:00
|
|
|
- name: Log in to the Container registry
|
|
|
|
id: docker-login
|
2022-10-12 12:05:58 -04:00
|
|
|
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # tag=v2.1.0
|
2022-08-03 05:46:11 -04:00
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Build CCM
|
|
|
|
run: |
|
2023-01-20 09:17:00 -05:00
|
|
|
bazelisk build //cmd/cloud-controller-manager:cloud-controller-manager
|
2023-01-18 04:15:58 -05:00
|
|
|
|
2022-08-03 05:46:11 -04:00
|
|
|
- name: Copy CCM
|
|
|
|
run: |
|
2022-10-17 02:58:13 -04:00
|
|
|
# support new and old bazel output paths
|
|
|
|
cp ./bazel-bin/cmd/cloud-controller-manager/cloud-controller-manager_/cloud-controller-manager ./cloud-controller-manager || \
|
2022-08-03 05:46:11 -04:00
|
|
|
cp ./bazel-bin/cmd/cloud-controller-manager/linux_amd64_pure_stripped/cloud-controller-manager ./cloud-controller-manager
|
2023-01-18 04:15:58 -05:00
|
|
|
|
2022-08-03 05:46:11 -04:00
|
|
|
- name: Prepare Dockerfile
|
|
|
|
run: |
|
|
|
|
cat > Dockerfile <<EOF
|
|
|
|
FROM scratch
|
|
|
|
COPY ./cloud-controller-manager /cloud-controller-manager
|
|
|
|
EOF
|
2023-01-18 04:15:58 -05:00
|
|
|
|
2022-08-03 05:46:11 -04:00
|
|
|
- name: Build and push container image
|
|
|
|
id: build
|
2023-01-31 11:38:44 -05:00
|
|
|
uses: docker/build-push-action@1104d471370f9806843c095c1db02b5a90c5f8b6 # v3.3.1
|
2022-08-03 05:46:11 -04:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: true
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|