From af4c5b0c59a5c100eb3b88a8ac8f0d2f96cb3f89 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 22 Aug 2025 14:17:55 +0800 Subject: [PATCH 1/3] clean up docker release workflow --- .github/workflows/docker-release.yml | 3 +- .github/workflows/docker.yaml | 53 ---------------------------- 2 files changed, 1 insertion(+), 55 deletions(-) delete mode 100644 .github/workflows/docker.yaml diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml index 32d8d99e6664..13fb0ec05f2a 100644 --- a/.github/workflows/docker-release.yml +++ b/.github/workflows/docker-release.yml @@ -1,7 +1,6 @@ name: Release to DockerHub (snapshot, stable) on: - pull_request: push: branches: - master @@ -70,4 +69,4 @@ jobs: run: | cp docker-entrypoint.sh ./modules/openapi-generator-cli docker buildx create --use - docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=${{ env.build_date }} --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$GITHUB_SHA --label=org.opencontainers.image.version=${{ env.cli_version }} -t ${{ env.DOCKER_CODEGEN_CLI_IMAGE_NAME }}:latest -t ${{ env.DOCKER_CODEGEN_CLI_IMAGE_NAME }}:${{ github.ref_name }} -t ${{ env.DOCKER_CODEGEN_CLI_IMAGE_NAME }} -t ${{ env.DOCKER_CODEGEN_CLI_IMAGE_NAME }}:latest-release ./modules/openapi-generator-cli \ No newline at end of file + docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=${{ env.build_date }} --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$GITHUB_SHA --label=org.opencontainers.image.version=${{ env.cli_version }} -t ${{ env.DOCKER_CODEGEN_CLI_IMAGE_NAME }}:latest -t ${{ env.DOCKER_CODEGEN_CLI_IMAGE_NAME }}:${{ github.ref_name }} -t ${{ env.DOCKER_CODEGEN_CLI_IMAGE_NAME }} -t ${{ env.DOCKER_CODEGEN_CLI_IMAGE_NAME }}:latest-release ./modules/openapi-generator-cli diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml deleted file mode 100644 index 50a5b040fd47..000000000000 --- a/.github/workflows/docker.yaml +++ /dev/null @@ -1,53 +0,0 @@ -name: Docker tests - -on: - workflow_dispatch: - push: - paths: - - Dockerfile - - run-in-docker.sh - - pom.xml - - modules/openapi-generator-online/pom.xml - - modules/openapi-generator-online/Dockerfile - - modules/openapi-generator-cli/pom.xml - - modules/openapi-generator-cli/Dockerfile - pull_request: - paths: - - Dockerfile - - run-in-docker.sh - - pom.xml - - modules/openapi-generator-online/pom.xml - - modules/openapi-generator-online/Dockerfile - - modules/openapi-generator-cli/pom.xml - - modules/openapi-generator-cli/Dockerfile -jobs: - build: - name: 'Build: Docker' - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v5 - - - name: Test run-in-docker.sh - shell: bash - run: | - sed -i 's/ -it / /g' run-in-docker.sh - ./run-in-docker.sh mvn -B clean install - - - name: Build Dockerfile - shell: bash - run: docker build . - - - name: Build modules/openapi-generator-online - shell: bash - run: | - docker build modules/openapi-generator-online/ -t test - - name: Build and test modules/openapi-generator-cli - shell: bash - run: | - cp docker-entrypoint.sh ./modules/openapi-generator-cli - docker build modules/openapi-generator-cli/ -t cli-test - docker run --rm -v "${PWD}:/local" cli-test generate \ - -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml \ - -g go \ - -o /local/out/go From ee3d157fbced77531944183e2b8284f8f7e97b6e Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 22 Aug 2025 14:18:59 +0800 Subject: [PATCH 2/3] undo --- .github/workflows/docker.yaml | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/docker.yaml diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 000000000000..50a5b040fd47 --- /dev/null +++ b/.github/workflows/docker.yaml @@ -0,0 +1,53 @@ +name: Docker tests + +on: + workflow_dispatch: + push: + paths: + - Dockerfile + - run-in-docker.sh + - pom.xml + - modules/openapi-generator-online/pom.xml + - modules/openapi-generator-online/Dockerfile + - modules/openapi-generator-cli/pom.xml + - modules/openapi-generator-cli/Dockerfile + pull_request: + paths: + - Dockerfile + - run-in-docker.sh + - pom.xml + - modules/openapi-generator-online/pom.xml + - modules/openapi-generator-online/Dockerfile + - modules/openapi-generator-cli/pom.xml + - modules/openapi-generator-cli/Dockerfile +jobs: + build: + name: 'Build: Docker' + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v5 + + - name: Test run-in-docker.sh + shell: bash + run: | + sed -i 's/ -it / /g' run-in-docker.sh + ./run-in-docker.sh mvn -B clean install + + - name: Build Dockerfile + shell: bash + run: docker build . + + - name: Build modules/openapi-generator-online + shell: bash + run: | + docker build modules/openapi-generator-online/ -t test + - name: Build and test modules/openapi-generator-cli + shell: bash + run: | + cp docker-entrypoint.sh ./modules/openapi-generator-cli + docker build modules/openapi-generator-cli/ -t cli-test + docker run --rm -v "${PWD}:/local" cli-test generate \ + -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml \ + -g go \ + -o /local/out/go From ca2f5a46b56e5451e0fc55d5da7a439fb47e3f9a Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 22 Aug 2025 14:21:58 +0800 Subject: [PATCH 3/3] comment out docker in travis.yml --- .travis.yml | 92 ++++++++++++++++++++++++++--------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/.travis.yml b/.travis.yml index d921b39a1ff2..b38c669c1b52 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,8 +32,8 @@ cache: - $HOME/.cache/deno - $HOME/.phpenv/versions/8.1.4 -services: - - docker +#services: +# - docker # comment out the host table change to use the public petstore server addons: @@ -47,16 +47,16 @@ addons: - petstore.swagger.io before_install: - - sudo rm -rf /var/lib/apt/lists/* - - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge" - - sudo apt-get update - #- sudo apt-get install -qqy --no-install-recommends google-chrome-stable - #- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce - - mkdir -vp ~/.docker/cli-plugins/ - - curl --silent -L "https://github.com/docker/buildx/releases/download/v0.3.0/buildx-v0.3.0.linux-amd64" > ~/.docker/cli-plugins/docker-buildx - - chmod a+x ~/.docker/cli-plugins/docker-buildx - # to run petstore server locally via docker +# - sudo rm -rf /var/lib/apt/lists/* +# - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +# - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge" +# - sudo apt-get update +# #- sudo apt-get install -qqy --no-install-recommends google-chrome-stable +# #- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce +# - mkdir -vp ~/.docker/cli-plugins/ +# - curl --silent -L "https://github.com/docker/buildx/releases/download/v0.3.0/buildx-v0.3.0.linux-amd64" > ~/.docker/cli-plugins/docker-buildx +# - chmod a+x ~/.docker/cli-plugins/docker-buildx +# # to run petstore server locally via docker #- echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin || true #- docker pull swaggerapi/petstore #- docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore @@ -133,7 +133,7 @@ script: # fail fast - set -e # show docker buildx version - - docker buildx version + #- docker buildx version # run integration tests defined in maven pom.xml # WARN: Travis will timeout after 10 minutes of no stdout/stderr activity, which is problematic with mvn --quiet. # show "error" only to reduce the log size @@ -169,39 +169,39 @@ after_success: popd; fi; fi; - ## docker: build and push openapi-generator-online to DockerHub - - if [ $DOCKER_HUB_USERNAME ]; then - echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin; - export cli_version=$(\mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\['); - export build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ"); - docker buildx create --use; - if [ ! -z "$TRAVIS_TAG" ]; then - docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-online --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_GENERATOR_IMAGE_NAME:latest -t $DOCKER_GENERATOR_IMAGE_NAME:$TRAVIS_TAG -t $DOCKER_GENERATOR_IMAGE_NAME -t $DOCKER_GENERATOR_IMAGE_NAME:latest-release ./modules/openapi-generator-online; - echo "Built and tagged $DOCKER_GENERATOR_IMAGE_NAME"; - fi; - if [ -z "$TRAVIS_TAG" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then - docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-online --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/openapi-generator-online; - echo "Pushed to $DOCKER_GENERATOR_IMAGE_NAME for master"; - fi; - fi; - ## docker: build cli image and push to Docker Hub - - if [ $DOCKER_HUB_USERNAME ]; then - echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin; - cp docker-entrypoint.sh ./modules/openapi-generator-cli; - export cli_version=$(\mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\['); - export build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ"); - docker buildx create --use; - docker buildx build --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli; - if [ ! -z "$TRAVIS_TAG" ]; then - docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest -t $DOCKER_CODEGEN_CLI_IMAGE_NAME:$TRAVIS_TAG -t $DOCKER_CODEGEN_CLI_IMAGE_NAME -t $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest-release ./modules/openapi-generator-cli; - echo "Built and tagged $DOCKER_GENERATOR_IMAGE_NAME"; - fi; - if [ -z "$TRAVIS_TAG" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then - docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli; - echo "Pushed to $DOCKER_CODEGEN_CLI_IMAGE_NAME"; - fi; - fi; - ## NOTE; we will do the followign manually instead as the page doesn't need to be updated in every single travis build +# ## docker: build and push openapi-generator-online to DockerHub +# - if [ $DOCKER_HUB_USERNAME ]; then +# echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin; +# export cli_version=$(\mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\['); +# export build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ"); +# docker buildx create --use; +# if [ ! -z "$TRAVIS_TAG" ]; then +# docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-online --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_GENERATOR_IMAGE_NAME:latest -t $DOCKER_GENERATOR_IMAGE_NAME:$TRAVIS_TAG -t $DOCKER_GENERATOR_IMAGE_NAME -t $DOCKER_GENERATOR_IMAGE_NAME:latest-release ./modules/openapi-generator-online; +# echo "Built and tagged $DOCKER_GENERATOR_IMAGE_NAME"; +# fi; +# if [ -z "$TRAVIS_TAG" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then +# docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-online --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/openapi-generator-online; +# echo "Pushed to $DOCKER_GENERATOR_IMAGE_NAME for master"; +# fi; +# fi; +## ## docker: build cli image and push to Docker Hub +# - if [ $DOCKER_HUB_USERNAME ]; then +# echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin; +# cp docker-entrypoint.sh ./modules/openapi-generator-cli; +# export cli_version=$(\mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\['); +# export build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ"); +# docker buildx create --use; +# docker buildx build --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli; +# if [ ! -z "$TRAVIS_TAG" ]; then +# docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest -t $DOCKER_CODEGEN_CLI_IMAGE_NAME:$TRAVIS_TAG -t $DOCKER_CODEGEN_CLI_IMAGE_NAME -t $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest-release ./modules/openapi-generator-cli; +# echo "Built and tagged $DOCKER_GENERATOR_IMAGE_NAME"; +# fi; +# if [ -z "$TRAVIS_TAG" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then +# docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli; +# echo "Pushed to $DOCKER_CODEGEN_CLI_IMAGE_NAME"; +# fi; +# fi; +# ## NOTE; we will do the followign manually instead as the page doesn't need to be updated in every single travis build ## publish latest website, variables below are secure environment variables which are unavailable to PRs from forks. # - if [ "$TRAVIS_BRANCH" = "master" ] && [ -z $TRAVIS_TAG ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then # sed -i "s/Vector{UInt8}/Vector\{UInt8\}/g" docs/generators/julia-client.md;