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:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-10-17 02:58:13 -04:00
|
|
|
version: [v25.2.0, v24.0.0, v23.0.0]
|
2022-08-03 05:46:11 -04:00
|
|
|
include:
|
2022-10-17 02:58:13 -04:00
|
|
|
- version: v25.2.0
|
2022-08-03 05:46:11 -04:00
|
|
|
latest: true
|
|
|
|
steps:
|
2022-10-12 12:05:58 -04:00
|
|
|
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.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
|
2022-10-18 07:00:41 -04:00
|
|
|
uses: docker/metadata-action@57396166ad8aefe6098280995947635806a0e6ea # tag=v4.1.1
|
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: Install bazelisk
|
|
|
|
run: |
|
2022-10-17 02:58:13 -04:00
|
|
|
curl -sLO "https://github.com/bazelbuild/bazelisk/releases/download/v1.14.0/bazelisk-linux-amd64"
|
2022-08-03 05:46:11 -04:00
|
|
|
mkdir -p "${GITHUB_WORKSPACE}/bin/"
|
|
|
|
mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
|
|
|
|
chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
|
|
|
|
|
|
|
|
- name: Build CCM
|
|
|
|
run: |
|
|
|
|
"${GITHUB_WORKSPACE}/bin/bazel" build //cmd/cloud-controller-manager:cloud-controller-manager
|
|
|
|
- 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
|
|
|
|
- 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
|
2022-10-12 12:05:58 -04:00
|
|
|
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5 # tag=v3.2.0
|
2022-08-03 05:46:11 -04:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: true
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|