From 151ff41918e51863df1b84331117f465545ae2df Mon Sep 17 00:00:00 2001 From: Brett Date: Thu, 2 Jan 2025 12:17:03 -0500 Subject: [PATCH 1/3] Revert "hotfix for merge conflict" This reverts commit 8b5e7bf858abebe5eaff5af512eb1730d9aa6014. --- .github/workflows/ci.yml | 1 + .github/workflows/ci_cron.yml | 1 + .github/workflows/tests_devdeps.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9dceff2eff..1d712bc1a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,7 @@ jobs: - linux: check-types test: uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@9f1f43251dde69da8613ea8e11144f05cdea41d5 # v1.15.0 + needs: [ crds_context ] with: setenv: | CRDS_PATH: /tmp/data/crds_cache diff --git a/.github/workflows/ci_cron.yml b/.github/workflows/ci_cron.yml index 1822318bbf..3f19dbe425 100644 --- a/.github/workflows/ci_cron.yml +++ b/.github/workflows/ci_cron.yml @@ -25,6 +25,7 @@ jobs: test: if: (github.repository == 'spacetelescope/jwst' && (github.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'run scheduled tests'))) uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@9f1f43251dde69da8613ea8e11144f05cdea41d5 # v1.15.0 + needs: [ crds_context ] with: setenv: | CRDS_PATH: /tmp/crds_cache diff --git a/.github/workflows/tests_devdeps.yml b/.github/workflows/tests_devdeps.yml index 5f79a9982d..8db7c09c01 100644 --- a/.github/workflows/tests_devdeps.yml +++ b/.github/workflows/tests_devdeps.yml @@ -34,6 +34,7 @@ jobs: test: if: (github.repository == 'spacetelescope/jwst' && (github.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'run devdeps tests'))) uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@9f1f43251dde69da8613ea8e11144f05cdea41d5 # v1.15.0 + needs: [ crds_context ] with: setenv: | CRDS_PATH: /tmp/data/crds_cache From 031358adb17dd2c0a280edbcb34722c5a444031f Mon Sep 17 00:00:00 2001 From: Brett Date: Thu, 2 Jan 2025 12:17:12 -0500 Subject: [PATCH 2/3] Revert "[CI] set default CRDS context to `jwst-edit` (#8987)" This reverts commit 974682f39e52e3d719c8d338b8f3ab32a644c313. --- .github/workflows/ci.yml | 20 +++++++++++++++----- .github/workflows/ci_cron.yml | 18 ++++++++++++++---- .github/workflows/contexts.yml | 26 ++++++++++++++++++++++++++ .github/workflows/tests_devdeps.yml | 18 ++++++++++++++---- 4 files changed, 69 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/contexts.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d712bc1a6..4c46a1f25f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,8 +20,8 @@ on: type: string required: false default: '' - crds_server_url: - description: CRDS server URL + crds_server: + description: CRDS server type: string required: false default: https://jwst-crds.stsci.edu @@ -46,18 +46,28 @@ jobs: envs: | - linux: check-dependencies - linux: check-types + latest_crds_contexts: + uses: ./.github/workflows/contexts.yml + crds_context: + needs: [ latest_crds_contexts ] + runs-on: ubuntu-latest + steps: + - id: context + run: echo context=${{ github.event_name == 'workflow_dispatch' && (inputs.crds_context != '' && inputs.crds_context || needs.latest_crds_contexts.outputs.jwst) || needs.latest_crds_contexts.outputs.jwst }} >> $GITHUB_OUTPUT + outputs: + context: ${{ steps.context.outputs.context }} test: uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@9f1f43251dde69da8613ea8e11144f05cdea41d5 # v1.15.0 needs: [ crds_context ] with: setenv: | CRDS_PATH: /tmp/data/crds_cache - CRDS_SERVER_URL: ${{ inputs.crds_server_url || 'https://jwst-crds.stsci.edu' }} - CRDS_CONTEXT: ${{ inputs.crds_context || 'jwst-edit' }} + CRDS_SERVER_URL: ${{ github.event_name == 'workflow_dispatch' && inputs.crds_server || 'https://jwst-crds.stsci.edu' }} + CRDS_CONTEXT: ${{ needs.crds_context.outputs.context }} CRDS_CLIENT_RETRY_COUNT: 3 CRDS_CLIENT_RETRY_DELAY_SECONDS: 20 cache-path: /tmp/data/crds_cache - cache-key: crds-${{ inputs.crds_context || 'jwst-edit' }} + cache-key: crds-${{ needs.crds_context.outputs.context }} envs: | - linux: py310-oldestdeps-xdist-cov pytest-results-summary: true diff --git a/.github/workflows/ci_cron.yml b/.github/workflows/ci_cron.yml index 3f19dbe425..c0db35ced5 100644 --- a/.github/workflows/ci_cron.yml +++ b/.github/workflows/ci_cron.yml @@ -11,8 +11,8 @@ on: type: string required: false default: '' - crds_server_url: - description: CRDS server URL + crds_server: + description: CRDS server type: string required: false default: https://jwst-crds.stsci.edu @@ -22,6 +22,16 @@ concurrency: cancel-in-progress: true jobs: + latest_crds_contexts: + uses: ./.github/workflows/contexts.yml + crds_context: + needs: [ latest_crds_contexts ] + runs-on: ubuntu-latest + steps: + - id: context + run: echo context=${{ github.event_name == 'workflow_dispatch' && (inputs.crds_context != '' && inputs.crds_context || needs.latest_crds_contexts.outputs.jwst) || needs.latest_crds_contexts.outputs.jwst }} >> $GITHUB_OUTPUT + outputs: + context: ${{ steps.context.outputs.context }} test: if: (github.repository == 'spacetelescope/jwst' && (github.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'run scheduled tests'))) uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@9f1f43251dde69da8613ea8e11144f05cdea41d5 # v1.15.0 @@ -29,8 +39,8 @@ jobs: with: setenv: | CRDS_PATH: /tmp/crds_cache - CRDS_SERVER_URL: ${{ inputs.crds_server_url || 'https://jwst-crds.stsci.edu' }} - CRDS_CONTEXT: ${{ inputs.crds_context || 'jwst-edit' }} + CRDS_SERVER_URL: ${{ github.event_name == 'workflow_dispatch' && inputs.crds_server || 'https://jwst-crds.stsci.edu' }} + CRDS_CONTEXT: ${{ needs.crds_context.outputs.context }} CRDS_CLIENT_RETRY_COUNT: 3 CRDS_CLIENT_RETRY_DELAY_SECONDS: 20 cache-path: /tmp/crds_cache diff --git a/.github/workflows/contexts.yml b/.github/workflows/contexts.yml new file mode 100644 index 0000000000..b3047bdb63 --- /dev/null +++ b/.github/workflows/contexts.yml @@ -0,0 +1,26 @@ +name: contexts + +on: + workflow_call: + outputs: + jwst: + value: ${{ jobs.contexts.outputs.jwst }} + workflow_dispatch: + +jobs: + contexts: + name: retrieve latest CRDS contexts + runs-on: ubuntu-latest + outputs: + jwst: ${{ steps.jwst_crds_context.outputs.pmap }} + steps: + - id: jwst_crds_context + env: + OBSERVATORY: jwst + CRDS_SERVER_URL: https://jwst-crds.stsci.edu + run: > + echo "pmap=$( + curl -s -X POST -d '{"jsonrpc": "1.0", "method": "get_default_context", "params": ["${{ env.OBSERVATORY }}", null], "id": 1}' ${{ env.CRDS_SERVER_URL }}/json/ --retry 8 --connect-timeout 10 | + python -c "import sys, json; print(json.load(sys.stdin)['result'])" + )" >> $GITHUB_OUTPUT + - run: if [[ ! -z "${{ steps.jwst_crds_context.outputs.pmap }}" ]]; then echo ${{ steps.jwst_crds_context.outputs.pmap }}; else exit 1; fi diff --git a/.github/workflows/tests_devdeps.yml b/.github/workflows/tests_devdeps.yml index 8db7c09c01..dda0e41f77 100644 --- a/.github/workflows/tests_devdeps.yml +++ b/.github/workflows/tests_devdeps.yml @@ -20,8 +20,8 @@ on: type: string required: false default: '' - crds_server_url: - description: CRDS server URL + crds_server: + description: CRDS server type: string required: false default: https://jwst-crds.stsci.edu @@ -31,6 +31,16 @@ concurrency: cancel-in-progress: true jobs: + latest_crds_contexts: + uses: ./.github/workflows/contexts.yml + crds_context: + needs: [ latest_crds_contexts ] + runs-on: ubuntu-latest + steps: + - id: context + run: echo context=${{ github.event_name == 'workflow_dispatch' && (inputs.crds_context != '' && inputs.crds_context || needs.latest_crds_contexts.outputs.jwst) || needs.latest_crds_contexts.outputs.jwst }} >> $GITHUB_OUTPUT + outputs: + context: ${{ steps.context.outputs.context }} test: if: (github.repository == 'spacetelescope/jwst' && (github.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'run devdeps tests'))) uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@9f1f43251dde69da8613ea8e11144f05cdea41d5 # v1.15.0 @@ -38,8 +48,8 @@ jobs: with: setenv: | CRDS_PATH: /tmp/data/crds_cache - CRDS_SERVER_URL: ${{ inputs.crds_server_url || 'https://jwst-crds.stsci.edu' }} - CRDS_CONTEXT: ${{ inputs.crds_context || 'jwst-edit' }} + CRDS_SERVER_URL: ${{ github.event_name == 'workflow_dispatch' && inputs.crds_server || 'https://jwst-crds.stsci.edu' }} + CRDS_CONTEXT: ${{ needs.crds_context.outputs.context }} CRDS_CLIENT_RETRY_COUNT: 3 CRDS_CLIENT_RETRY_DELAY_SECONDS: 20 cache-path: /tmp/data/crds_cache From e82bac975467a309d23f754c95e9343615ccccac Mon Sep 17 00:00:00 2001 From: Brett Date: Thu, 2 Jan 2025 12:25:22 -0500 Subject: [PATCH 3/3] use crds client for getting edit context --- .github/workflows/contexts.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/contexts.yml b/.github/workflows/contexts.yml index b3047bdb63..da86c221b2 100644 --- a/.github/workflows/contexts.yml +++ b/.github/workflows/contexts.yml @@ -18,9 +18,7 @@ jobs: env: OBSERVATORY: jwst CRDS_SERVER_URL: https://jwst-crds.stsci.edu - run: > - echo "pmap=$( - curl -s -X POST -d '{"jsonrpc": "1.0", "method": "get_default_context", "params": ["${{ env.OBSERVATORY }}", null], "id": 1}' ${{ env.CRDS_SERVER_URL }}/json/ --retry 8 --connect-timeout 10 | - python -c "import sys, json; print(json.load(sys.stdin)['result'])" - )" >> $GITHUB_OUTPUT + run: | + pip install crds + echo "pmap=$(crds list --resolve-contexts --contexts jwst-edit)" >> $GITHUB_OUTPUT - run: if [[ ! -z "${{ steps.jwst_crds_context.outputs.pmap }}" ]]; then echo ${{ steps.jwst_crds_context.outputs.pmap }}; else exit 1; fi