Skip to content

Commit 0c530df

Browse files
authored
fix(CI): Build the generator and release images on pushes (#12273)
All pushes to master and release branches will result in a tag of the name of the branch. PR CI also verifies the images build properly prior to merge. Signed-off-by: mprahl <[email protected]>
1 parent a2d39da commit 0c530df

File tree

11 files changed

+122
-29
lines changed

11 files changed

+122
-29
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build tools images
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- 'release-*'
8+
pull_request:
9+
branches:
10+
- master
11+
- 'release-*'
12+
workflow_dispatch: {}
13+
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
env:
19+
IMAGE_REGISTRY: ghcr.io
20+
IMAGE_ORG: ${{ github.repository_owner }}
21+
IMAGE_TAG: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }}
22+
23+
concurrency:
24+
group: build-tools-images-${{ github.ref_name }}
25+
cancel-in-progress: false
26+
27+
jobs:
28+
build-tools:
29+
name: Build tools images
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v5
34+
35+
- name: Log in to the Container registry
36+
uses: docker/login-action@v3
37+
if: github.event_name != 'pull_request'
38+
with:
39+
registry: ${{ env.IMAGE_REGISTRY }}
40+
username: ${{ github.actor }}
41+
password: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Build and push api-generator
44+
id: build_api
45+
uses: docker/build-push-action@v6
46+
with:
47+
context: .
48+
file: backend/api/Dockerfile
49+
push: ${{ github.event_name != 'pull_request' }}
50+
tags: |
51+
${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_ORG }}/kfp-api-generator:${{ env.IMAGE_TAG }}
52+
53+
- name: Build and push release tools
54+
uses: docker/build-push-action@v6
55+
with:
56+
context: .
57+
file: test/release/Dockerfile.release
58+
push: ${{ github.event_name != 'pull_request' }}
59+
build-args: |
60+
BASE_IMAGE=${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_ORG }}/kfp-api-generator:${{ env.IMAGE_TAG }}
61+
tags: |
62+
${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_ORG }}/kfp-release:${{ env.IMAGE_TAG }}

api/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
# Contact one of chensun, HumairAK if this remote image needs an update.
16-
PREBUILT_REMOTE_IMAGE=ghcr.io/kubeflow/kfp-api-generator:1.2
16+
PREBUILT_REMOTE_IMAGE=ghcr.io/kubeflow/kfp-api-generator:master
1717

1818
.PHONY: all
1919
all: golang python

backend/api/Dockerfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
# limitations under the License.
1414

1515
# Generate client code (go & json) from API protocol buffers
16-
FROM golang:1.24 as generator
17-
ENV GRPC_GATEWAY_VERSION v2.27.1
18-
ENV GO_SWAGGER_VERSION v0.32.3
19-
ENV GRPC_VERSION v1.73.0
20-
ENV PROTOC_VERSION 31.1
16+
FROM golang:1.24 AS generator
17+
ENV GRPC_GATEWAY_VERSION=v2.27.1
18+
ENV GO_SWAGGER_VERSION=v0.32.3
19+
ENV GRPC_VERSION=v1.73.0
20+
ENV PROTOC_VERSION=31.1
2121
ENV GOBIN=/go/bin
2222
# The googleapis repo doesn't use GitHub releases or version tags,
2323
# so we pin a specific commit to make the clone reproducible.
24-
ENV GOOGLEAPIS_COMMIT 68d5196a529174df97c28c70622ffc1c3721815f
24+
ENV GOOGLEAPIS_COMMIT=68d5196a529174df97c28c70622ffc1c3721815f
2525

2626
# **Note** that protoc-gen-go-grpc is packaged with grpc-go but is versioned
2727
# separately. You can find the releases for protoc-gen-go-grpc here:
@@ -37,7 +37,7 @@ ENV GOOGLEAPIS_COMMIT 68d5196a529174df97c28c70622ffc1c3721815f
3737
# **Note** That BOTH PROTOC_GEN_GO_GRPC & PROTOBUF_GO here are used for
3838
# Generating GO Code. These versions should be identical to the
3939
# runtime Go packages (in the project go.mod)
40-
ENV PROTOC_GEN_GO_GRPC v1.5.1
40+
ENV PROTOC_GEN_GO_GRPC=v1.5.1
4141
ENV PROTOBUF_GO=v1.36.6
4242

4343
# Install protoc.
@@ -49,8 +49,8 @@ RUN unzip -o protoc.zip -d /tmp/protoc && \
4949
RUN unzip -o protoc.zip 'include/*' -d /tmp/protoc && \
5050
mv /tmp/protoc/include/* /usr/include
5151
RUN rm -f protoc.zip
52-
ENV PROTOCCOMPILER /usr/bin/protoc
53-
ENV PROTOCINCLUDE /usr/include/google/protobuf
52+
ENV PROTOCCOMPILER=/usr/bin/protoc
53+
ENV PROTOCINCLUDE=/usr/include/google/protobuf
5454

5555
# Need grpc-gateway source code for -I in protoc command.
5656
# Install protoc-gen-rpc-gateway && protoc-gen-swagger.
@@ -77,10 +77,10 @@ RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@${PROTOC_GEN_GO_GRP
7777

7878
# Needed for buildling python packages requiring protoc
7979
RUN apt-get update && apt-get install -y python3-pip
80-
RUN pip3 install --upgrade pip setuptools wheel --break-system-packages
80+
RUN apt-get -y upgrade python3-pip && pip3 install --upgrade setuptools wheel --break-system-packages
8181

8282
# WORKAROUND: https://github.com/docker-library/golang/issues/225#issuecomment-403170792
83-
ENV XDG_CACHE_HOME /tmp/.cache
83+
ENV XDG_CACHE_HOME=/tmp/.cache
8484
# Make all files accessible to non-root users.
8585
RUN chmod -R 777 /usr/bin/
8686
RUN chmod -R 777 /usr/include/google

backend/api/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ REMOTE_IMAGE=ghcr.io/kubeflow/kfp-api-generator
2121
API_VERSION ?= v2beta1
2222

2323
# Keep in sync with the version used in test/release/Dockerfile.release
24-
PREBUILT_REMOTE_IMAGE=ghcr.io/kubeflow/kfp-api-generator:1.2
25-
RELEASE_IMAGE=ghcr.io/kubeflow/kfp-release:1.2.1
24+
PREBUILT_REMOTE_IMAGE=ghcr.io/kubeflow/kfp-api-generator:master
25+
RELEASE_IMAGE=ghcr.io/kubeflow/kfp-release:master
2626
CONTAINER_ENGINE ?= docker
2727

2828
# Generate clients using a pre-built api-generator image.

backend/api/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,16 @@ API definitions in this folder are used to generate [`v1beta1`](https://www.kube
7777

7878
4. Create a PR with the changes in [kubeflow.org website repository](https://github.com/kubeflow/website). See an example [here](https://github.com/kubeflow/website/pull/3444).
7979

80-
## Updating API generator image
80+
## Updating API generator image (Manual)
81+
82+
This is now automatic on pushes to GitHub branches, but the instructions are kept here in case you need to do it
83+
manually.
8184

8285
API generator image is defined in [Dockerfile](`./Dockerfile`). If you need to update the container, follow these steps:
8386

8487
1. Login to GHCR container registry: `echo "<PAT>" | docker login ghcr.io -u <USERNAME> --password-stdin`
8588
* Replace `<PAT>` with a GitHub Personal Access Token (PAT) with the write:packages and `read:packages` scopes, as well as `delete:packages` if needed.
86-
1. Update the [Dockerfile](`./Dockerfile`) and build the image by running `docker build -t ghcr.io/kubeflow/kfp-api-generator:$VERSION .`
87-
1. Push the new container by running `docker push ghcr.io/kubeflow/kfp-api-generator:$VERSION`.
89+
1. Update the [Dockerfile](`./Dockerfile`) and build the image by running `docker build -t ghcr.io/kubeflow/kfp-api-generator:$BRANCH .`
90+
1. Push the new container by running `docker push ghcr.io/kubeflow/kfp-api-generator:$BRANCH`.
8891
1. Update the `PREBUILT_REMOTE_IMAGE` variable in the [Makefile](./Makefile) to point to your new image.
89-
1. Similarly, push a new version of the release tools image to `ghcr.io/kubeflow/kfp-release:$VERSION` and run `make push` in [test/release/Makefile](../../test/release/Makefile).
92+
1. Similarly, push a new version of the release tools image to `ghcr.io/kubeflow/kfp-release:$BRANCH` and run `make push` in [test/release/Makefile](../../test/release/Makefile).

kubernetes_platform/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
PREBUILT_REMOTE_IMAGE=ghcr.io/kubeflow/kfp-api-generator:1.2
15+
PREBUILT_REMOTE_IMAGE=ghcr.io/kubeflow/kfp-api-generator:master
1616

1717
# Set USE_FIND_LINKS=true to use local sdk and pipeline_spec for buildling python builds rather than pulling from pypi
1818
# applies to `make python` and make pythone-dev` commands.

sdk/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
# Contact one of chensun, HumairAK if this remote image needs an update.
16-
PREBUILT_REMOTE_IMAGE=ghcr.io/kubeflow/kfp-api-generator:1.2
16+
PREBUILT_REMOTE_IMAGE=ghcr.io/kubeflow/kfp-api-generator:master
1717

1818
.PHONY: python
1919
python: python

test/release/Dockerfile.release

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,23 @@
1414

1515
# Based on KFP backend api client generator dockerfile
1616
# Keep in sync with the version used in backend/api/Makefile
17-
FROM ghcr.io/kubeflow/kfp-api-generator:1.2
17+
# Allow overriding the base image tag at build time
18+
ARG BASE_IMAGE=ghcr.io/kubeflow/kfp-api-generator:master
19+
FROM ${BASE_IMAGE}
1820

1921
# install nvm & node 12
2022
# Reference: https://stackoverflow.com/a/28390848
21-
ENV NODE_VERSION 12.21.0
23+
ENV NODE_VERSION=12.21.0
2224
ENV NVM_DIR=/usr/local/nvm
2325
RUN mkdir -p $NVM_DIR && \
2426
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash && \
2527
. $NVM_DIR/nvm.sh && \
2628
nvm install $NODE_VERSION && \
2729
nvm alias default $NODE_VERSION && \
2830
nvm use default
29-
ENV NODE_PATH $NVM_DIR/versions/node/v$NODE_VERSION/lib/node_modules
30-
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
31-
ENV GIT_CLIFF_VERSION 2.10.0
31+
ENV NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/lib/node_modules
32+
ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
33+
ENV GIT_CLIFF_VERSION=2.10.0
3234

3335
# install java==11 python==3
3436
RUN apt-get update \

test/release/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
REMOTE=ghcr.io/kubeflow/kfp-release:1.2.1
15+
REMOTE=ghcr.io/kubeflow/kfp-release:master
1616

1717
CONTAINER_ENGINE ?= docker
1818

test/release/bump-version-docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if [[ -z "$TAG_NAME" ]]; then
3131
fi
3232

3333
pushd "${REPO_ROOT}"
34-
RELEASE_IMAGE=${RELEASE_IMAGE:-ghcr.io/kubeflow/kfp-release:1.2.1}
34+
RELEASE_IMAGE=${RELEASE_IMAGE:-ghcr.io/kubeflow/kfp-release:master}
3535
docker run -it --rm \
3636
--user $(id -u):$(id -g) \
3737
--mount type=bind,source="$(pwd)",target=/go/src/github.com/kubeflow/pipelines \

0 commit comments

Comments
 (0)