-
Notifications
You must be signed in to change notification settings - Fork 20
Introduce pre-prod for homebrew [DI-707] #317
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
Changes from all commits
6a22f5d
20dd019
19df782
2158b3d
164ca59
60fb885
58e085b
902a4ec
3e3ca60
4437003
7a23dc2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # To ensure that both setter and getter use the same. format | ||
| name: Get Homebrew PR Title | ||
|
|
||
| inputs: | ||
| hz-version: | ||
| required: true | ||
| hz-distribution: | ||
| required: true | ||
| outputs: | ||
| title: | ||
| value: Hazelcast Homebrew Package ${{ inputs.hz-version }} ${{ inputs.hz-distribution }} release | ||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - shell: bash | ||
| run: exit 0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| name: Promote BREW package | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| HZ_VERSION: | ||
| description: 'Version of Hazelcast to promote for, this is the Maven version - e.g.: 5.0.2 or 5.1-SNAPSHOT' | ||
| required: true | ||
| type: string | ||
| HZ_DISTRIBUTION: | ||
| description: 'Distribution to be promote: hazelcast or hazelcast-enterprise' | ||
| required: true | ||
| type: string | ||
| ENVIRONMENT: | ||
| description: 'Environment to use' | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| promote-homebrew: | ||
| environment: ${{ inputs.ENVIRONMENT }} | ||
| runs-on: ubuntu-slim | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - uses: aws-actions/configure-aws-credentials@v5 | ||
| with: | ||
| role-to-assume: ${{ secrets.AWS_DEV_INFRA_OIDC_GITHUB_ACTIONS_ROLE_ARN }} | ||
| aws-region: 'us-east-1' | ||
|
|
||
| - uses: aws-actions/aws-secretsmanager-get-secrets@v2 | ||
| with: | ||
| secret-ids: | | ||
| GITHUB/DEVOPSHAZELCAST | ||
| parse-json-secrets: true | ||
|
|
||
| - uses: ./.github/actions/get-homebrew-pr-title | ||
| id: get-homebrew-pr-title | ||
| with: | ||
| hz-version: ${{ inputs.HZ_VERSION }} | ||
| hz-distribution: ${{ inputs.HZ_DISTRIBUTION }} | ||
|
|
||
| - name: Merge PR | ||
| run: | | ||
| set -euo pipefail ${RUNNER_DEBUG:+-x} | ||
|
|
||
| source logging.functions.sh | ||
|
|
||
| # Get the username associated with the supplied token | ||
| USERNAME=$(gh api user --jq ".login") | ||
|
|
||
| # Find corresponding staged PRs | ||
| PR_URLS=$( | ||
| gh pr list \ | ||
| --repo "${{ vars.BREW_GIT_REPO_NAME }}" \ | ||
| --search "'${{ steps.get-homebrew-pr-title.outputs.title }}' in:title author:${USERNAME}" \ | ||
nishaatr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| --json url \ | ||
| --jq '.[].url' | ||
| ) | ||
|
|
||
| if [[ -z "${PR_URLS}" ]]; then | ||
| echoerr "No PRs found to promote" | ||
| exit 1 | ||
| else | ||
| while read -r PR_URL; do | ||
| gh pr merge \ | ||
| "${PR_URL}" \ | ||
| --squash | ||
| done <<< "${PR_URLS}" | ||
| fi | ||
| env: | ||
| GH_TOKEN: ${{ env.GITHUB_DEVOPSHAZELCAST_SECRET }} | ||
| HZ_VERSION: ${{ inputs.HZ_VERSION }} | ||
| HZ_DISTRIBUTION: ${{ inputs.HZ_DISTRIBUTION }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| name: Promote from pre-prod to prod | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| VERSION: | ||
| description: 'The version to promote' | ||
| required: true | ||
| RELEASE_TYPE: | ||
| description: 'What should be promoted' | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - ALL | ||
| - OSS | ||
| - EE | ||
| ENVIRONMENT: | ||
| description: 'Environment to use' | ||
| required: true | ||
| type: environment | ||
| distinct_id: | ||
| description: 'Required exclusively for automated execution to track status of workflow execution' | ||
| required: false | ||
|
|
||
| jobs: | ||
| prepare: | ||
| runs-on: ubuntu-slim | ||
| outputs: | ||
| distribution-types: ${{ steps.distribution-type-matrix.outputs.matrix }} | ||
| steps: | ||
| # https://github.com/Codex-/return-dispatch#receiving-repository-action | ||
| - name: Logging distinct ID (${{ github.event.inputs.distinct_id }}) | ||
| run: echo ${{ github.event.inputs.distinct_id }} | ||
|
|
||
| - id: resolve-editions | ||
| uses: hazelcast/docker-actions/resolve-editions@master | ||
| with: | ||
| release-type: ${{ inputs.RELEASE_TYPE }} | ||
|
|
||
| - name: Compute distribution type matrix | ||
| id: distribution-type-matrix | ||
| run: | | ||
| # We expect at least _one_ output distribution type, otherwise will produce an empty array that will break GitHub matrixes | ||
| entries=() | ||
|
|
||
| if [ "${{ steps.resolve-editions.outputs.should_build_oss }}" = "true" ]; then | ||
| entries+=('{"distribution":"hazelcast"}') | ||
| fi | ||
| if [ "${{ steps.resolve-editions.outputs.should_build_ee }}" = "true" ]; then | ||
| entries+=('{"distribution":"hazelcast-enterprise"}') | ||
| fi | ||
|
|
||
| json="[$(IFS=,; echo "${entries[*]}")]" | ||
| echo "matrix=$json" >> "${GITHUB_OUTPUT}" | ||
|
|
||
JackPGreen marked this conversation as resolved.
Show resolved
Hide resolved
JackPGreen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| promote: | ||
| needs: prepare | ||
| uses: ./.github/workflows/promote-brew-package.yml | ||
| strategy: | ||
| matrix: | ||
| distribution-type: ${{ fromJSON(needs.prepare.outputs.distribution-types) }} | ||
| with: | ||
| HZ_VERSION: ${{ inputs.VERSION }} | ||
| HZ_DISTRIBUTION: ${{ matrix.distribution-type.distribution }} | ||
| ENVIRONMENT: ${{ inputs.ENVIRONMENT }} | ||
| secrets: inherit | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,8 @@ jobs: | |
| runs-on: macos-latest | ||
| permissions: | ||
| id-token: write | ||
| outputs: | ||
| pull-request-operation: ${{ steps.create-pull-request.outputs.pull-request-operation }} | ||
| env: | ||
| HZ_VERSION: ${{ inputs.HZ_VERSION }} | ||
| PACKAGE_VERSION: ${{ inputs.PACKAGE_VERSION || inputs.HZ_VERSION }} | ||
|
|
@@ -128,19 +130,21 @@ jobs: | |
| source ./common.sh | ||
| brew uninstall ${HZ_DISTRIBUTION}@$BREW_PACKAGE_VERSION | ||
|
|
||
| - name: Commit changes & Push to ${{ env.BREW_GIT_REPO_NAME }} repo | ||
| working-directory: ${{ env.BREW_GIT_REPO_LOCATION }} | ||
| run: | | ||
| git config --global user.name "${GITHUB_ACTOR}" | ||
| git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
| git add *.rb | ||
| if [[ `git status --porcelain --untracked-files=no` ]]; then | ||
| git commit -am "Hazelcast Homebrew Package ${PACKAGE_VERSION} release" | ||
| git pull --rebase | ||
| git push | ||
| else | ||
| echo "No changes, this is probably a re-run." | ||
| fi | ||
| - uses: ./.github/actions/get-homebrew-pr-title | ||
| id: get-homebrew-pr-title | ||
| with: | ||
| hz-version: ${{ inputs.HZ_VERSION }} | ||
| hz-distribution: ${{ inputs.HZ_DISTRIBUTION }} | ||
|
|
||
| - name: Create PR for changes in ${{ vars.BREW_GIT_REPO_NAME }} repo | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How this will work now, without a build promotion orchestrator?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We haven't properly discussed how the promotion orchestrator hook into staged PRs, but when we breifly discussed it we said were happy with a manual PR merge. One of the "post-merge" actions is to update the release docs to note that a generated PR will need to be merged.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To avoid disturbing the release process maybe we could automatically trigger artifacts promotion for now? |
||
| uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0 | ||
| id: create-pull-request | ||
| with: | ||
| token: ${{ env.GITHUB_DEVOPSHAZELCAST_SECRET }} | ||
| path: ${{ env.BREW_GIT_REPO_LOCATION }} | ||
| branch: ${{ github.job }}_run_${{ github.run_id }} | ||
| title: ${{ steps.get-homebrew-pr-title.outputs.title }} | ||
| body: Generated by ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}. | ||
|
|
||
| - name: Store logs as artifact | ||
| if: ${{ always() }} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.