diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 2954e9dff3..78dc145821 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -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 + diff --git a/client-java-contrib/cert-manager/update.sh b/client-java-contrib/cert-manager/update.sh index 73d6d0dee7..838c893e5f 100755 --- a/client-java-contrib/cert-manager/update.sh +++ b/client-java-contrib/cert-manager/update.sh @@ -16,6 +16,9 @@ # 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 @@ -23,9 +26,8 @@ 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 \ diff --git a/client-java-contrib/prometheus-operator/update.sh b/client-java-contrib/prometheus-operator/update.sh index 65b41ce4d0..2f1390cd29 100755 --- a/client-java-contrib/prometheus-operator/update.sh +++ b/client-java-contrib/prometheus-operator/update.sh @@ -16,6 +16,9 @@ # 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 @@ -23,9 +26,8 @@ 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 \