Scan For New Associations #236
Workflow file for this run
This file contains 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
# This workflow scans CMR every 5 minutes to check for new collection associations to the l2ss-py UMM-S record | |
# in UAT and OPS. If a new association is found, a PR is opened to add the new collection concept id to the | |
# cmr/*_associations.txt file. | |
name: Scan For New Associations | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 1 * * *' | |
jobs: | |
find_new: | |
name: Find new associations | |
runs-on: ubuntu-latest | |
outputs: | |
new_uat_associations: ${{ steps.diff.outputs.new_uat_associations }} | |
new_ops_associations: ${{ steps.diff.outputs.new_ops_associations }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install Poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: 1.5.1 | |
- name: Run diff | |
id: diff | |
env: | |
UAT_TOKEN_TEMP: ${{ secrets.LAUNCHPAD_TOKEN_UAT }} | |
OPS_TOKEN_TEMP: ${{ secrets.LAUNCHPAD_TOKEN_OPS }} | |
run: | | |
poetry install | |
ls $GITHUB_WORKSPACE/tests/cmr/uat/ > $GITHUB_WORKSPACE/tests/cmr/uat_associations.txt | |
ls $GITHUB_WORKSPACE/tests/cmr/ops/ > $GITHUB_WORKSPACE/tests/cmr/ops_associations.txt | |
poetry run cmr_association_diff -e uat -t service -p POCLOUD -n 'PODAAC L2 Cloud Subsetter' -a $GITHUB_WORKSPACE/tests/cmr/uat_associations.txt --token $UAT_TOKEN_TEMP > $GITHUB_WORKSPACE/tests/cmr/new_uat_associations.txt | |
poetry run cmr_association_diff -e ops -t service -p POCLOUD -n 'PODAAC L2 Cloud Subsetter' -a $GITHUB_WORKSPACE/tests/cmr/ops_associations.txt --token $OPS_TOKEN_TEMP > $GITHUB_WORKSPACE/tests/cmr/new_ops_associations.txt | |
echo "new_uat_associations=$(poetry run python tests/collection_names.py --env uat --token $UAT_TOKEN_TEMP --file $GITHUB_WORKSPACE/tests/cmr/new_uat_associations.txt)" >> $GITHUB_OUTPUT | |
echo "new_ops_associations=$(poetry run python tests/collection_names.py --env ops --token $OPS_TOKEN_TEMP --file $GITHUB_WORKSPACE/tests/cmr/new_ops_associations.txt)" >> $GITHUB_OUTPUT | |
rm $GITHUB_WORKSPACE/tests/cmr/uat_associations.txt | |
rm $GITHUB_WORKSPACE/tests/cmr/ops_associations.txt | |
rm $GITHUB_WORKSPACE/tests/cmr/new_uat_associations.txt | |
rm $GITHUB_WORKSPACE/tests/cmr/new_ops_associations.txt | |
open_pr_uat: | |
needs: find_new | |
strategy: | |
fail-fast: false | |
max-parallel: 2 | |
matrix: | |
concept_data: ${{fromJson(needs.find_new.outputs.new_uat_associations)}} | |
runs-on: ubuntu-latest | |
name: UAT ${{ matrix.concept_id }} | |
steps: | |
- name: Get collection ShortName for readability | |
run: | | |
concept_data=${{ matrix.concept_data }} | |
# Extract data from the dictionary | |
short_name=$(echo "$concept_data" | jq -r '.short_name') | |
concept_id=$(echo "$concept_data" | jq -r '.concept_id') | |
# Perform actions with $short_name and $concept_id | |
echo "Processing: $short_name, $concept_id" | |
open_pr_ops: | |
needs: find_new | |
strategy: | |
fail-fast: false | |
max-parallel: 2 | |
matrix: | |
concept_data: ${{fromJson(needs.find_new.outputs.new_ops_associations)}} | |
runs-on: ubuntu-latest | |
name: OPS ${{ matrix.concept_id }} | |
steps: | |
- name: Get collection ShortName for readability | |
run: | | |
concept_data=${{ matrix.concept_data }} | |
# Extract data from the dictionary | |
short_name=$(echo "$concept_data" | jq -r '.short_name') | |
concept_id=$(echo "$concept_data" | jq -r '.concept_id') | |
# Perform actions with $short_name and $concept_id | |
echo "Processing: $short_name, $concept_id" | |