-
Notifications
You must be signed in to change notification settings - Fork 11
Add helm charts & build publish workflows #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ba10eb5
Add helm charts
terryyylim 1ca5ac5
Rename management service helm chart values
terryyylim 2aee26c
Add build and publish steps
terryyylim 8c158a1
Rename CI workflow file
terryyylim 284fb19
Temporarily remove publish step
terryyylim 3469d24
Fix CI build-publish workflows
terryyylim 9dbf9dc
Add dependencies to build stage workflow
terryyylim 256c1db
Update golangci-lint
terryyylim 479c51a
Fix go vendoring step
terryyylim 4057495
Download UI cache
terryyylim 204aa04
Rename treatment service api container
terryyylim 2e065a1
Add helm chart publish workflow
terryyylim 0de81b5
Update README.md with replace directive instructions
terryyylim fc72732
Cleanup docs
terryyylim 047efe4
Test binary artifact upload and download
terryyylim aa787a6
Combine build publish steps
terryyylim cb30c37
Rename release CI step
terryyylim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| name: Release Rules Checker | ||
| description: Determines release type based on the git ref and provided rules | ||
|
|
||
| inputs: | ||
| release_tag_regex: | ||
| required: false | ||
| description: 'Regex to match the git tag to determine if this a release run of the workflow' | ||
| default: 'v[0-9]+(\.[0-9]+){0,2}' | ||
| prerelease_tag_regex: | ||
| required: false | ||
| description: 'Regex to match the git tag to determine if this a pre-release run of the workflow' | ||
| default: 'v[0-9]+(\.[0-9]+){0,2}(-([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?' | ||
| prefix: | ||
| required: false | ||
| description: "(Optional) prefix of git tags to use. Example: 'sdk/'" | ||
| default: '' | ||
| outputs: | ||
| release-type: | ||
| description: 'Type of the release. One of: [dev, pre-release, release]' | ||
| value: ${{ steps.tag-check.outputs.release-type }} | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - run: | | ||
| release_regex='^refs/tags/${{ inputs.prefix }}${{ inputs.release_tag_regex }}$' | ||
| prerelease_regex='^refs/tags/${{ inputs.prefix }}${{ inputs.prerelease_tag_regex }}$' | ||
| if [[ '${{ github.event.ref }}' =~ ${release_regex} ]]; then | ||
| echo '::set-output name=release-type::release' | ||
| elif [[ '${{ github.event.ref }}' =~ ${prerelease_regex} ]]; then | ||
| echo '::set-output name=release-type::pre-release' | ||
| else | ||
| echo '::set-output name=release-type::dev' | ||
| fi | ||
| id: tag-check | ||
| shell: bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: helm-chart | ||
|
|
||
| on: | ||
| push: | ||
| paths: | ||
| - ".github/workflows/helm-chart.yml" | ||
| - "infra/charts/**" | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
| inputs: | ||
| owner: | ||
| description: The GitHub user or org that owns this repository | ||
| type: string | ||
| required: true | ||
| repository: | ||
| description: The GitHub repository | ||
| type: string | ||
| required: true | ||
| default: "charts" | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Run chart-releaser | ||
| uses: stefanprodan/helm-gh-pages@v1.4.1 | ||
| with: | ||
| token: "${{ secrets.GH_PAGES_TOKEN }}" | ||
| charts_dir: infra/charts | ||
| owner: "${{ github.event.inputs.owner || 'turing-ml' }}" | ||
| repository: "${{ github.event.inputs.repository || 'charts' }}" | ||
| commit_username: ${{ github.actor }} | ||
| commit_email: "${{ github.actor }}@users.noreply.github.com" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,210 @@ | ||
| name: XP Release | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| container_registry: | ||
| type: string | ||
| required: false | ||
| default: ghcr.io | ||
| environment: | ||
| type: string | ||
| required: false | ||
| secrets: | ||
| ghcr_token: | ||
| required: true | ||
|
|
||
| env: | ||
| ARTIFACT_RETENTION_DAYS: 7 | ||
|
|
||
| jobs: | ||
| build-ui: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: ui | ||
| steps: | ||
| - name: Checkout to the target branch | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: 14 | ||
|
|
||
| - name: Get yarn cache directory path | ||
| id: yarn-cache-dir-path | ||
| run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
|
||
| - name: Cache YARN | ||
| uses: actions/cache@v3 | ||
| id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||
| with: | ||
| path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
| key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-yarn- | ||
|
|
||
| - name: Install | ||
| run: yarn install --network-concurrency 1 | ||
|
|
||
| - name: Lint code | ||
| run: yarn lint | ||
|
|
||
| - name: Build UI | ||
| env: | ||
| NODE_OPTIONS: "--max_old_space_size=4096" | ||
| run: yarn build | ||
|
|
||
| - name: Publish Artifact | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: xp-ui-dist | ||
| path: ui/build/ | ||
| retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }} | ||
|
|
||
| build-management-service: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| APP_NAME: xp-management | ||
| needs: | ||
| - build-ui | ||
| outputs: | ||
| api-version: ${{ steps.build-image.outputs.api-version }} | ||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Download UI Dist | ||
| uses: actions/download-artifact@v2 | ||
| with: | ||
| name: xp-ui-dist | ||
| path: ui/build | ||
|
|
||
| - name: Download Management Service binary | ||
| uses: actions/download-artifact@v2 | ||
| with: | ||
| name: management-service-binary | ||
| path: management-service/bin/ | ||
|
|
||
| - name: Sync vendor directory | ||
| working-directory: management-service | ||
| run: | | ||
| echo "Fetching dependencies..." | ||
| go mod vendor | ||
|
|
||
| - name: Build Docker image | ||
| id: build-image | ||
| run: | | ||
| set -o pipefail | ||
| make BIN_NAME=$APP_NAME build-image | tee output.log | ||
| echo "::set-output name=api-version::$(sed -n 's%xp-api version: \(.*\)%\1%p' output.log)" | ||
|
|
||
| - name: Save Docker image | ||
| run: | | ||
| docker image save \ | ||
| --output xp-management.${{ steps.build-image.outputs.api-version }}.tar \ | ||
| xp-management:${{ steps.build-image.outputs.api-version }} | ||
|
|
||
| - name: Publish Artifact | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: xp-management.${{ steps.build-image.outputs.api-version }}.tar | ||
| path: xp-management.${{ steps.build-image.outputs.api-version }}.tar | ||
| retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }} | ||
|
|
||
| build-treatment-service: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| APP_NAME: xp-treatment | ||
| outputs: | ||
| api-version: ${{ steps.build-image.outputs.api-version }} | ||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Download Treatment Service binary | ||
| uses: actions/download-artifact@v2 | ||
| with: | ||
| name: treatment-service-binary | ||
| path: treatment-service/bin/ | ||
|
|
||
| - name: Build Docker image | ||
| id: build-image | ||
| working-directory: treatment-service | ||
| run: | | ||
| set -o pipefail | ||
| make BIN_NAME=$APP_NAME build-image | tee output.log | ||
| echo "::set-output name=api-version::$(sed -n 's%xp-api version: \(.*\)%\1%p' output.log)" | ||
|
|
||
| - name: Save Docker image | ||
| run: | | ||
| docker image save \ | ||
| --output xp-treatment.${{ steps.build-image.outputs.api-version }}.tar \ | ||
| xp-treatment:${{ steps.build-image.outputs.api-version }} | ||
|
|
||
| - name: Publish Artifact | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: xp-treatment.${{ steps.build-image.outputs.api-version }}.tar | ||
| path: xp-treatment.${{ steps.build-image.outputs.api-version }}.tar | ||
| retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }} | ||
|
|
||
| publish-management-service: | ||
| runs-on: ubuntu-latest | ||
| environment: ${{ inputs.environment }} | ||
| needs: | ||
| - build-management-service | ||
| steps: | ||
| - name: Log in to the Container registry | ||
| uses: docker/login-action@v1 | ||
| with: | ||
| registry: ${{ inputs.container_registry }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.ghcr_token }} | ||
|
|
||
| - name: Download Docker image tar | ||
| uses: actions/download-artifact@v2 | ||
| with: | ||
| name: xp-management.${{ needs.build-management-service.outputs.api-version }}.tar | ||
|
|
||
| - name: Publish Docker Image | ||
| env: | ||
| DOCKER_REPOSITORY: ${{ inputs.container_registry }}/${{ github.repository }} | ||
| run: | | ||
| docker image load --input xp-management.${{ needs.build-management-service.outputs.api-version }}.tar | ||
| docker tag \ | ||
| xp-management:${{ needs.build-management-service.outputs.api-version }} \ | ||
| ${{ env.DOCKER_REPOSITORY }}/xp-management:${{ needs.build-management-service.outputs.api-version }} | ||
| docker push ${{ env.DOCKER_REPOSITORY }}/xp-management:${{ needs.build-management-service.outputs.api-version }} | ||
|
|
||
| publish-treatment-service: | ||
| runs-on: ubuntu-latest | ||
| environment: ${{ inputs.environment }} | ||
| needs: | ||
| - build-treatment-service | ||
| steps: | ||
| - name: Log in to the Container registry | ||
| uses: docker/login-action@v1 | ||
| with: | ||
| registry: ${{ inputs.container_registry }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.ghcr_token }} | ||
|
|
||
| - name: Download Docker image tar | ||
| uses: actions/download-artifact@v2 | ||
| with: | ||
| name: xp-treatment.${{ needs.build-treatment-service.outputs.api-version }}.tar | ||
|
|
||
| - name: Publish Docker Image | ||
| env: | ||
| DOCKER_REPOSITORY: ${{ inputs.container_registry }}/${{ github.repository }} | ||
| run: | | ||
| docker image load --input xp-treatment.${{ needs.build-treatment-service.outputs.api-version }}.tar | ||
| docker tag \ | ||
| xp-treatment:${{ needs.build-treatment-service.outputs.api-version }} \ | ||
| ${{ env.DOCKER_REPOSITORY }}/xp-treatment:${{ needs.build-treatment-service.outputs.api-version }} | ||
| docker push ${{ env.DOCKER_REPOSITORY }}/xp-treatment:${{ needs.build-treatment-service.outputs.api-version }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To uncomment release action in subsequent PR.