Skip to content

Commit

Permalink
adding CRD model gen action job
Browse files Browse the repository at this point in the history
  • Loading branch information
yue9944882 committed Sep 15, 2020
1 parent d680d1f commit a44b189
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,29 @@ jobs:
-B \
-De2e.skip=false \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
codegen:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
name: CRD Java Models Code Generation
steps:
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: kubernetes-client/java/crd-model-gen
tags: gh-action-tmp
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
workdir: client-java-contrib
no_push: true
- name: Run Code-gen for Cert-Manager
working-directory: ${{ github.workspace }}/client-java-contrib/cert-manager
run: IMAGE_TAG=gh-action-tmp ./update.sh
- name: Run Code-gen for Prometheus-Operator
working-directory: ${{ github.workspace }}/client-java-contrib/prometheus-operator
run: IMAGE_TAG=gh-action-tmp ./update.sh

6 changes: 4 additions & 2 deletions client-java-contrib/cert-manager/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@
# This script generates the model classes from a released version of cert-manager CRDs
# under src/main/java/io/cert/manager/models.

IMAGE_NAME=${IMAGE_NAME:docker.pkg.github.com/kubernetes-client/java/crd-model-gen}
IMAGE_TAG=${IMAGE_TAG:v1.0.2}

# a crdgen container is run in a way that:
# 1. it has access to the docker daemon on the host so that it is able to create sibling container on the host
# 2. it runs on the host network so that it is able to communicate with the KinD cluster it launched on the host
docker run \
--rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "$(pwd)":"$(pwd)" \
-ti \
--network host \
docker.pkg.github.com/kubernetes-client/java/crd-model-gen:v1.0.2 \
${IMAGE_NAME}:${IMAGE_TAG} \
/generate.sh \
-u https://github.com/jetstack/cert-manager/releases/download/v0.16.1/cert-manager.crds.yaml \
-n io.cert-manager \
Expand Down
6 changes: 4 additions & 2 deletions client-java-contrib/prometheus-operator/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@
# This script generates the model classes from a released version of cert-manager CRDs
# under src/main/java/io/cert/manager/models.

IMAGE_NAME=${IMAGE_NAME:docker.pkg.github.com/kubernetes-client/java/crd-model-gen}
IMAGE_TAG=${IMAGE_TAG:v1.0.2}

# a crdgen container is run in a way that:
# 1. it has access to the docker daemon on the host so that it is able to create sibling container on the host
# 2. it runs on the host network so that it is able to communicate with the KinD cluster it launched on the host
docker run \
--rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "$(pwd)":"$(pwd)" \
-ti \
--network host \
docker.pkg.github.com/kubernetes-client/java/crd-model-gen:v1.0.2 \
${IMAGE_NAME}:${IMAGE_TAG} \
/generate.sh \
-u https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.38.1/example/prometheus-operator-crd/monitoring.coreos.com_alertmanagers.yaml \
-u https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.38.1/example/prometheus-operator-crd/monitoring.coreos.com_thanosrulers.yaml \
Expand Down

0 comments on commit a44b189

Please sign in to comment.