Skip to content

Commit

Permalink
vendorize and fix contexts workflow (#518)
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram authored Oct 21, 2024
1 parent 9006b03 commit 57478e0
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
outputs:
data_path: ${{ steps.data_path.outputs.path }}
crds_contexts:
uses: spacetelescope/crds/.github/workflows/contexts.yml@7a0fe0b50d5f426cdf1ba8d3ac5c406705773f2a # 12.0.3
uses: ./.github/workflows/contexts.yml
test_downstream:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@924441154cf3053034c6513d5e06c69d262fb9a6 # v1.13.0
needs: [ environment, crds_contexts ]
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/contexts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: contexts

on:
workflow_call:
outputs:
jwst:
value: ${{ jobs.contexts.outputs.jwst }}
roman:
value: ${{ jobs.contexts.outputs.roman }}
workflow_dispatch:

jobs:
contexts:
name: retrieve latest CRDS contexts
runs-on: ubuntu-latest
outputs:
jwst: ${{ steps.jwst_crds_context.outputs.pmap }}
roman: ${{ steps.roman_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
- id: roman_crds_context
env:
OBSERVATORY: roman
CRDS_SERVER_URL: https://roman-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 |
python -c "import sys, json; print(json.load(sys.stdin)['result'])"
)" >> $GITHUB_OUTPUT
- run: if [[ ! -z "${{ steps.roman_crds_context.outputs.pmap }}" ]]; then echo ${{ steps.roman_crds_context.outputs.pmap }}; else exit 1; fi

0 comments on commit 57478e0

Please sign in to comment.