fix: avoid OptionSet.getOptions() N+1 in analytics metadata resolution [DHIS2-21975] #34390
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
| name: Deploy instance | |
| on: | |
| pull_request: | |
| types: [opened, reopened, labeled, synchronize] | |
| # Cancel previous runs of the same workflow and PR number or branch/tag | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| checks: read # for t3chguy/wait-on-check-action | |
| pull-requests: write # for actions-cool/maintain-one-comment | |
| jobs: | |
| deploy-instance: | |
| if: contains(github.event.pull_request.labels.*.name, 'deploy') | |
| runs-on: ubuntu-latest | |
| env: | |
| HTTP: https --check-status | |
| USER_EMAIL: ${{ secrets.IM_BOT_EMAIL }} | |
| PASSWORD: ${{ secrets.IM_BOT_PASSWORD }} | |
| IM_HOST: 'https://api.im.dhis2.org' | |
| INSTANCE_HOST: 'https://dev.im.dhis2.org' | |
| INSTANCE_NAME: pr-${{ github.event.pull_request.number }} | |
| steps: | |
| - name: Wait for API tests | |
| # Using this fork of the upstream https://github.com/lewagon/wait-on-check-action, | |
| # as it will filter out and check only the latest run of a workflow when checking for the allowed conclusions, | |
| # instead of checking all of the re-runs and possibly failing due to skipped or cancelled runs. | |
| # See https://github.com/lewagon/wait-on-check-action/issues/85 for more info. | |
| # SHA-pinned to immutable commit instead of mutable @master to mitigate supply-chain | |
| # risk from this dormant single-maintainer fork. Update deliberately after reviewing | |
| # upstream changes. Current pin equals master HEAD as of 2026-05-22. | |
| uses: t3chguy/wait-on-check-action@18541021811b56544d90e0f073401c2b99e249d6 # master @ 2026-05-22 (fork has no tags) | |
| with: | |
| ref: ${{ github.head_ref }} | |
| check-name: 'api-test' | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| allowed-conclusions: success | |
| - name: 'Get latest IM tag' | |
| id: latest-im-tag | |
| run: | | |
| LATEST_IM_TAG=$(git ls-remote --tags --sort='v:refname' https://github.com/dhis2-sre/im-manager | tail -1 | awk '{print $2}') | |
| echo "LATEST_IM_TAG=$LATEST_IM_TAG" >> $GITHUB_ENV | |
| - uses: actions/checkout@v7 | |
| with: | |
| repository: dhis2-sre/im-manager | |
| ref: ${{ env.LATEST_IM_TAG }} | |
| sparse-checkout: scripts/instances | |
| - name: Install HTTPie | |
| run: python -m pip install httpie | |
| - name: Deploy DHIS2 instance | |
| working-directory: scripts/instances | |
| env: | |
| IMAGE_REPOSITORY: core-pr | |
| IMAGE_TAG: ${{ github.event.pull_request.number }} | |
| IMAGE_PULL_POLICY: Always | |
| DATABASE_ID: test-dbs-sierra-leone-dev-sql-gz | |
| run: | | |
| ./findByName.sh dev $INSTANCE_NAME | jq --exit-status 'has("id")' && | |
| ./restart.sh $(./findByName.sh dev $INSTANCE_NAME | jq '.instances[] | select(.stackName=="dhis2-core") | .id') || | |
| ./deploy-dhis2.sh dev $INSTANCE_NAME | |
| - name: Wait for instance | |
| working-directory: scripts/instances | |
| env: | |
| EXPECTED_STATUS: Running | |
| run: | | |
| export INSTANCE_ID=$(./findByName.sh dev $INSTANCE_NAME | jq '.instances[] | select(.stackName=="dhis2-core") | .id') | |
| timeout 600 bash -ex -c 'until [[ "$(./status.sh $INSTANCE_ID | jq -r)" == "$EXPECTED_STATUS" ]]; do echo "Instance is not $EXPECTED_STATUS yet ..."; sleep 5; done' | |
| - name: Start analytics generation | |
| run: curl -X POST -u "${{ secrets.DHIS2_USERNAME }}:${{ secrets.DHIS2_PASSWORD }}" "$INSTANCE_HOST/$INSTANCE_NAME/api/resourceTables/analytics" -d 'executeTei=true' | |
| - name: Comment instance URL | |
| uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5 | |
| with: | |
| message: "Instance deployed to https://dev.im.dhis2.org/pr-${{ github.event.pull_request.number }}" |