From 988b53123eb8f4ca6286eb2fa8cd885a894f673d Mon Sep 17 00:00:00 2001 From: sulhicader Date: Wed, 31 Jan 2024 14:51:49 +0530 Subject: [PATCH] Combined tour image publish to one script #2180 --- .github/workflows/helm-release-tour.yaml | 33 ---- .github/workflows/release-wave.yml | 197 ++++++++--------------- .github/workflows/wave-bundle-tour.yaml | 67 -------- .github/workflows/wave-publish-tour.yaml | 33 ---- .github/workflows/wave-tour.yaml | 25 --- 5 files changed, 65 insertions(+), 290 deletions(-) delete mode 100644 .github/workflows/helm-release-tour.yaml delete mode 100644 .github/workflows/wave-bundle-tour.yaml delete mode 100644 .github/workflows/wave-publish-tour.yaml delete mode 100644 .github/workflows/wave-tour.yaml diff --git a/.github/workflows/helm-release-tour.yaml b/.github/workflows/helm-release-tour.yaml deleted file mode 100644 index 67d09f0b32..0000000000 --- a/.github/workflows/helm-release-tour.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: Release Generated Helm Chart - -on: - workflow_call: - inputs: - build-version: - type: string - description: The version of the application/image to be pushed - required: true - -jobs: - retrieve-metadata: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Get App Version - id: get-build-version - run: | - echo "VERSION=${{ inputs.build-version }}" >> "$GITHUB_OUTPUT" - - release-helm-chart: - needs: retrieve-metadata - permissions: - id-token: write # This is required for requesting the JWT - contents: read # This is required for actions/checkout - - uses: ./.github/workflows/wave-bundle-helm-release.yaml - with: - build-version: ${{ inputs.build-version }} - helm-chart-artifact: wave-bundle-helm - wave-app-name: tour diff --git a/.github/workflows/release-wave.yml b/.github/workflows/release-wave.yml index a67bff1165..12d6991f1d 100644 --- a/.github/workflows/release-wave.yml +++ b/.github/workflows/release-wave.yml @@ -1,154 +1,87 @@ name: Release Wave on: - workflow_dispatch: - inputs: - version: - description: 'Release Version' - required: true + push: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - VERSION: "${{ github.event.inputs.version }}" - TAG: "v${{ github.event.inputs.version }}" + VERSION: "1.0.0" + TAG: "v1.0.0" jobs: - release: - name: Release Wave - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - with: - token: ${{ secrets.GIT_TOKEN }} - - uses: actions/setup-go@v1 - with: - go-version: '1.19.4' - - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' + create-bundle: + name: Create Wave Bundle + runs-on: ubuntu-latest - - name: Setup - run: make setup + outputs: + build-version: ${{ env.VERSION }} - - uses: r-lib/actions/setup-r@v2 - - uses: r-lib/actions/setup-r-dependencies@v2 - with: - working-directory: ./r + steps: + - uses: actions/checkout@v3 - - name: Build Release - run: make release - env: - NODE_OPTIONS: '--max-old-space-size=8192' + - name: Download H2O CLI + working-directory: ./py/apps/tour + run: mkdir -p .bin && curl -o .bin/h2o https://h2oai-cloud-release.s3.amazonaws.com/releases/ai/h2o/h2o-cloud/latest/cli/linux-amd64/h2o - - name: Unit Test - run: | - make test-ui-ci - make test-py-ci + - name: Change permissions + working-directory: ./py/apps/tour + run: chmod +x .bin/h2o - - name: Create GitHub Release - id: create_release - uses: actions/create-release@v1 - with: - tag_name: ${{ env.TAG }} - release_name: ${{ env.TAG }} - draft: false + - name: Set version + working-directory: ./py/apps/tour + run: sed -i -r -e "s/\{\{VERSION\}\}/${{ env.VERSION }}/g" app.toml - - name: Release - uses: softprops/action-gh-release@v1 - with: - files: | - build/wave-${{ env.VERSION }}-darwin-amd64.tar.gz - build/wave-${{ env.VERSION }}-darwin-arm64.tar.gz - build/wave-${{ env.VERSION }}-linux-amd64.tar.gz - build/wave-${{ env.VERSION }}-windows-amd64.tar.gz - py/h2o_wave/dist/h2o_wave-${{ env.VERSION }}-py3-none-macosx_10_9_x86_64.whl - py/h2o_wave/dist/h2o_wave-${{ env.VERSION }}-py3-none-macosx_11_0_arm64.whl - py/h2o_wave/dist/h2o_wave-${{ env.VERSION }}-py3-none-macosx_12_0_arm64.whl - py/h2o_wave/dist/h2o_wave-${{ env.VERSION }}-py3-none-manylinux1_x86_64.whl - py/h2o_wave/dist/h2o_wave-${{ env.VERSION }}-py3-none-win_amd64.whl - py/h2o_wave/dist/h2o_wave-${{ env.VERSION }}-py3-none-any.whl - r/build/h2owave_${{ env.VERSION }}_R.tar.gz - tag_name: ${{ env.TAG }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Publish to Conda - uses: amauryval/publish_conda_package_action@1.1.0 - with: - CondaDir: 'py/h2o_wave/conda' - CondaUsername: ${{ secrets.CONDA_USERNAME }} - CondaPassword: ${{ secrets.CONDA_PASSWORD }} - env: - # VERSION clashes with conda build. Use PKG_VERSION instead. - PKG_VERSION: ${{ env.VERSION }} - - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - packages_dir: py/h2o_wave/dist - password: ${{ secrets.PYPI_API_TOKEN }} + - name: Get App Version + id: get-build-version + run: | + echo "VERSION=${{ env.VERSION }}" >> "$GITHUB_OUTPUT" - - name: Publish Docs + - name: Make the folder structure run: | - make publish-website - aws cloudfront create-invalidation --distribution-id $AWS_CLOUDFRONT_DISTRIBUTION_ID --paths "/*" - env: - AWS_CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: ${{ secrets.AWS_WEST_REGION }} - - - name: Publish to S3 - run: make publish-release-s3 - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: ${{ secrets.AWS_EAST_REGION }} - - - name: Publish apps for Cloud - run: make build-apps publish-apps-s3-hac - env: - HAC_S3_BUCKET : ${{ secrets.HAC_S3_BUCKET }} - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: ${{ secrets.AWS_WEST_REGION }} - - - name: Publish apps for Managed Cloud - run: make publish-apps-s3-mc - env: - MC_S3_BUCKET : ${{ secrets.MC_S3_BUCKET }} - AWS_ACCESS_KEY_ID: ${{ secrets.MC_AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY : ${{ secrets.MC_AWS_SECRET_ACCESS_KEY }} - AWS_REGION: ${{ secrets.MC_AWS_REGION }} - - # Call some time after cloudfront cache bust - crawler needs to hit fresh cache. - - name: Reindex Algolia search + find py/apps/tour -type f -name '*.toml' -exec sed -i -e "s/{{VERSION}}/${{ env.VERSION }}/g" {} \; + find py/apps/tour -type f -name 'requirements.txt' -exec sed -i -e "s/{{VERSION}}/${{ env.VERSION }}/g" {} \; + rsync -a py/examples py/apps/tour --exclude "*.idea*" --exclude "*__pycache__*" --exclude "*.mypy_cache*" --exclude "dist" --exclude "build" + cp tools/vscode-extension/base-snippets.json py/apps/tour/examples + cp tools/vscode-extension/component-snippets.json py/apps/tour/examples + cp tools/vscode-extension/server/utils.py py/apps/tour/examples/tour_autocomplete_utils.py + cp tools/vscode-extension/server/parser.py py/apps/tour/examples/tour_autocomplete_parser.py + sed -i -r -e "s#^@app\(('|\")(.*)('|\")(.*)#@app\('/'\4#" py/apps/tour/examples/tour.py + + - name: Make air-gapped bundle + working-directory: ./py/apps/tour run: | - curl -X POST -H "Content-Type: application/json" --user $ALGOLIA_CRAWLER_USER_ID:$ALGOLIA_CRAWLER_API_KEY https://crawler.algolia.com/api/1/crawlers/$ALGOLIA_CRAWLER_ID/reindex - env: - ALGOLIA_CRAWLER_API_KEY: ${{ secrets.ALGOLIA_CRAWLER_API_KEY }} - ALGOLIA_CRAWLER_ID: ${{ secrets.ALGOLIA_CRAWLER_ID }} - ALGOLIA_CRAWLER_USER_ID: ${{ secrets.ALGOLIA_CRAWLER_USER_ID }} - - - name: Build university - run: make publish-university - - - name: Publish to PyPI - wave_university - uses: pypa/gh-action-pypi-publish@master - with: - packages_dir: university/dist - password: ${{ secrets.PYPI_UNIVERSITY_TOKEN }} - - - name: Publish to PyPI - lightwave - uses: pypa/gh-action-pypi-publish@master + .bin/h2o bundle \ + --docker-base-image 524466471676.dkr.ecr.us-east-1.amazonaws.com/q8s/launcher:v0.31.0-310 \ + --docker-use-buildkit \ + --generate-helm-charts \ + --helm-chart-version ${{ env.VERSION }} \ + --helm-chart-name tour \ + --helm-app-bundle-image-repo 524466471676.dkr.ecr.us-east-1.amazonaws.com/h2oai/tour-bundle \ + --helm-app-runtime-image-repo 524466471676.dkr.ecr.us-east-1.amazonaws.com/h2oai/tour \ + --generate-dockerfile + + - uses: actions/upload-artifact@v3 with: - packages_dir: py/h2o_lightwave/dist - password: ${{ secrets.PYPI_LIGTHWAVE_TOKEN }} + name: wave-bundle + path: | + ./py/apps/tour/*.Dockerfile + ./py/apps/tour/*.wave - - name: Publish to PyPI - lightwave_web - uses: pypa/gh-action-pypi-publish@master + - uses: actions/upload-artifact@v3 with: - packages_dir: py/h2o_lightwave_web/dist - password: ${{ secrets.PYPI_LIGTHWAVE_WEB_TOKEN }} + name: wave-bundle-helm + path: py/apps/tour/helm/ + + build-and-publish: + needs: create-bundle + permissions: + id-token: write # This is required for requesting the JWT + contents: read # This is required for actions/checkout + + uses: ./.github/workflows/wave-bundle-docker-build-publish.yaml + with: + build-version: ${{ needs.create-bundle.outputs.build-version }} + bundle-artifact: wave-bundle + wave-app-name: tour diff --git a/.github/workflows/wave-bundle-tour.yaml b/.github/workflows/wave-bundle-tour.yaml deleted file mode 100644 index cf8ee04a0c..0000000000 --- a/.github/workflows/wave-bundle-tour.yaml +++ /dev/null @@ -1,67 +0,0 @@ -name: Wave Bundle - -on: - workflow_call: - inputs: - build-version: - type: string - description: The version of the application/image to be pushed - required: true - -jobs: - airgapped: - name: Create Wave Bundle - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Download H2O CLI - working-directory: ./py/apps/tour - run: mkdir -p .bin && curl -o .bin/h2o https://h2oai-cloud-release.s3.amazonaws.com/releases/ai/h2o/h2o-cloud/latest/cli/linux-amd64/h2o - - - name: Change permissions - working-directory: ./py/apps/tour - run: chmod +x .bin/h2o - - - name: Get App Version - id: get-build-version - run: | - echo "VERSION=${{ inputs.build-version }}" >> "$GITHUB_OUTPUT" - - - name: Make the folder structure - run: | - find py/apps/tour -type f -name '*.toml' -exec sed -i -e "s/{{VERSION}}/${{ inputs.build-version }}/g" {} \; - find py/apps/tour -type f -name 'requirements.txt' -exec sed -i -e "s/{{VERSION}}/${{ inputs.build-version }}/g" {} \; - rsync -a py/examples py/apps/tour --exclude "*.idea*" --exclude "*__pycache__*" --exclude "*.mypy_cache*" --exclude "dist" --exclude "build" - cp tools/vscode-extension/base-snippets.json py/apps/tour/examples - cp tools/vscode-extension/component-snippets.json py/apps/tour/examples - cp tools/vscode-extension/server/utils.py py/apps/tour/examples/tour_autocomplete_utils.py - cp tools/vscode-extension/server/parser.py py/apps/tour/examples/tour_autocomplete_parser.py - sed -i -r -e "s#^@app\(('|\")(.*)('|\")(.*)#@app\('/'\4#" py/apps/tour/examples/tour.py - - - name: Make air-gapped bundle - working-directory: ./py/apps/tour - run: | - .bin/h2o bundle \ - --docker-base-image 524466471676.dkr.ecr.us-east-1.amazonaws.com/q8s/launcher:v0.31.0-310 \ - --docker-use-buildkit \ - --generate-helm-charts \ - --helm-chart-version ${{ inputs.build-version }} \ - --helm-chart-name tour \ - --helm-app-bundle-image-repo 524466471676.dkr.ecr.us-east-1.amazonaws.com/h2oai/tour-bundle \ - --helm-app-runtime-image-repo 524466471676.dkr.ecr.us-east-1.amazonaws.com/h2oai/tour \ - --generate-dockerfile - - - uses: actions/upload-artifact@v3 - with: - name: wave-bundle - path: | - ./py/apps/tour/*.Dockerfile - ./py/apps/tour/*.wave - - - uses: actions/upload-artifact@v3 - with: - name: wave-bundle-helm - path: py/apps/tour/helm/ - diff --git a/.github/workflows/wave-publish-tour.yaml b/.github/workflows/wave-publish-tour.yaml deleted file mode 100644 index fb3ec4c42b..0000000000 --- a/.github/workflows/wave-publish-tour.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: Publish Wave Bundle - -on: - workflow_call: - inputs: - build-version: - type: string - description: The version of the application/image to be pushed - required: true - -jobs: - retrieve-metadata: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Get App Version - id: get-build-version - run: | - echo "VERSION=${{ inputs.build-version }}" >> "$GITHUB_OUTPUT" - - build-and-publish: - needs: retrieve-metadata - permissions: - id-token: write # This is required for requesting the JWT - contents: read # This is required for actions/checkout - - uses: ./.github/workflows/wave-bundle-docker-build-publish.yaml - with: - build-version: ${{ inputs.build-version }} - bundle-artifact: wave-bundle - wave-app-name: tour diff --git a/.github/workflows/wave-tour.yaml b/.github/workflows/wave-tour.yaml deleted file mode 100644 index d479a682cc..0000000000 --- a/.github/workflows/wave-tour.yaml +++ /dev/null @@ -1,25 +0,0 @@ -name: Wave Bundle - -on: - push: - -jobs: - bundle: - name: Create Wave Bundle - uses: ./.github/workflows/wave-bundle-tour.yaml - with: - build-version: 1.0.0 - - publish: - needs: bundle - name: Build and Publish - uses: ./.github/workflows/wave-publish-tour.yaml - with: - build-version: 1.0.0 - - helm-publish: - needs: bundle - name: Build and Publish Helm Chart - uses: ./.github/workflows/helm-release-tour.yaml - with: - build-version: 1.0.0