From 213e6b204e9d25d86e67d882701f255649ef0779 Mon Sep 17 00:00:00 2001 From: sulhicader Date: Mon, 20 Nov 2023 10:23:32 +0530 Subject: [PATCH] packaging: Added initial workflow files on #2180 --- .github/workflows/helm-release-tour.yaml | 33 ++++++++++++ .github/workflows/wave-bundle-tour.yaml | 67 ++++++++++++++++++++++++ .github/workflows/wave-publish-tour.yaml | 33 ++++++++++++ .github/workflows/wave-tour.yaml | 25 +++++++++ 4 files changed, 158 insertions(+) create mode 100644 .github/workflows/helm-release-tour.yaml create mode 100644 .github/workflows/wave-bundle-tour.yaml create mode 100644 .github/workflows/wave-publish-tour.yaml create mode 100644 .github/workflows/wave-tour.yaml diff --git a/.github/workflows/helm-release-tour.yaml b/.github/workflows/helm-release-tour.yaml new file mode 100644 index 0000000000..67d09f0b32 --- /dev/null +++ b/.github/workflows/helm-release-tour.yaml @@ -0,0 +1,33 @@ +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/wave-bundle-tour.yaml b/.github/workflows/wave-bundle-tour.yaml new file mode 100644 index 0000000000..75f1550338 --- /dev/null +++ b/.github/workflows/wave-bundle-tour.yaml @@ -0,0 +1,67 @@ +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.23.0-38 \ + --docker-include static \ + --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 new file mode 100644 index 0000000000..fb3ec4c42b --- /dev/null +++ b/.github/workflows/wave-publish-tour.yaml @@ -0,0 +1,33 @@ +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 new file mode 100644 index 0000000000..56094a4b73 --- /dev/null +++ b/.github/workflows/wave-tour.yaml @@ -0,0 +1,25 @@ +name: Wave Bundle + +on: + push: + +jobs: + bundle: + name: Create Wave Bundle + uses: ./.github/workflows/wave-bundle-tour.yaml + with: + build-version: 0.22.0 + + publish: + needs: bundle + name: Build and Publish + uses: ./.github/workflows/wave-publish-tour.yaml + with: + build-version: 0.22.0 + + helm-publish: + needs: bundle + name: Build and Publish Helm Chart + uses: ./.github/workflows/helm-release-tour.yaml + with: + build-version: 0.22.0