Skip to content

Commit 3c27486

Browse files
authored
Feature/edl lambda token (#4337)
* update tests to use lambda to get tokens * update poetry lock * add labels * add code to prevent duplicate prs
1 parent 4d065af commit 3c27486

File tree

10 files changed

+887
-697
lines changed

10 files changed

+887
-697
lines changed

.github/workflows/diff.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,25 @@ jobs:
8484
app_id: ${{ secrets.CICD_APP_ID }}
8585
private_key: ${{ secrets.CICD_APP_PRIVATE_KEY }}
8686
- uses: actions/checkout@v4
87+
- name: Check for existing PR
88+
id: existing_pr
89+
env:
90+
GH_TOKEN: ${{ steps.podaac-cicd.outputs.token }}
91+
run: |
92+
pr_count=$(gh pr list --head "diff/uat/${{ matrix.data.concept_id }}" --state open --json number --jq 'length')
93+
if [ "$pr_count" -gt 0 ]; then
94+
echo "exists=true" >> "$GITHUB_OUTPUT"
95+
else
96+
echo "exists=false" >> "$GITHUB_OUTPUT"
97+
fi
8798
- name: Update uat_associations
99+
if: steps.existing_pr.outputs.exists != 'true'
88100
run: |
89101
mkdir -p $GITHUB_WORKSPACE/tests/cmr/l2ss-py/uat
90102
echo "${{ matrix.data.concept_id }}" > $GITHUB_WORKSPACE/tests/cmr/l2ss-py/uat/${{ matrix.data.concept_id }}
91103
- name: Create Pull Request for ${{ env.SHORT_NAME }}
92104
id: cpr
105+
if: steps.existing_pr.outputs.exists != 'true'
93106
uses: peter-evans/create-pull-request@v6
94107
with:
95108
token: ${{ steps.podaac-cicd.outputs.token }}
@@ -106,6 +119,7 @@ jobs:
106119
unverified
107120
autotest
108121
- name: Enable Pull Request Automerge
122+
if: steps.existing_pr.outputs.exists != 'true'
109123
env:
110124
GH_TOKEN: ${{ github.token }}
111125
run: gh pr merge --merge --auto ${{ steps.cpr.outputs.pull-request-number }}
@@ -128,12 +142,25 @@ jobs:
128142
app_id: ${{ secrets.CICD_APP_ID }}
129143
private_key: ${{ secrets.CICD_APP_PRIVATE_KEY }}
130144
- uses: actions/checkout@v4
145+
- name: Check for existing PR
146+
id: existing_pr
147+
env:
148+
GH_TOKEN: ${{ steps.podaac-cicd.outputs.token }}
149+
run: |
150+
pr_count=$(gh pr list --head "diff/ops/${{ matrix.data.concept_id }}" --state open --json number --jq 'length')
151+
if [ "$pr_count" -gt 0 ]; then
152+
echo "exists=true" >> "$GITHUB_OUTPUT"
153+
else
154+
echo "exists=false" >> "$GITHUB_OUTPUT"
155+
fi
131156
- name: Update ops_associations
157+
if: steps.existing_pr.outputs.exists != 'true'
132158
run: |
133159
mkdir -p $GITHUB_WORKSPACE/tests/cmr/l2ss-py/ops
134160
echo "${{ matrix.data.concept_id }}" > $GITHUB_WORKSPACE/tests/cmr/l2ss-py/ops/${{ matrix.data.concept_id }}
135161
- name: Create Pull Request for ${{ env.SHORT_NAME }}
136162
id: cpr
163+
if: steps.existing_pr.outputs.exists != 'true'
137164
uses: peter-evans/create-pull-request@v6
138165
with:
139166
token: ${{ steps.podaac-cicd.outputs.token }}
@@ -150,6 +177,7 @@ jobs:
150177
unverified
151178
autotest
152179
- name: Enable Pull Request Automerge
180+
if: steps.existing_pr.outputs.exists != 'true'
153181
env:
154182
GH_TOKEN: ${{ github.token }}
155183
run: gh pr merge --merge --auto ${{ steps.cpr.outputs.pull-request-number }}

.github/workflows/new_regression.yml

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -135,30 +135,23 @@ jobs:
135135
pattern: job-status-*
136136
path: job-status
137137

138-
- name: Set CMR bearer token dynamically
139-
id: set-cmr-token
140-
run: |
141-
case "${{ needs.setup-and-chunk.outputs.environment_upper }}" in
142-
UAT)
143-
echo "CMR_BEARER_TOKEN=${{ secrets.UAT_URS_TOKEN }}" >> $GITHUB_ENV
144-
;;
145-
OPS)
146-
echo "CMR_BEARER_TOKEN=${{ secrets.OPS_URS_TOKEN }}" >> $GITHUB_ENV
147-
;;
148-
*)
149-
echo "❌ Unknown environment: ${{ needs.setup-and-chunk.outputs.environment_upper }}" >&2
150-
exit 1
151-
;;
152-
esac
138+
- name: Configure AWS credentials for UAT
139+
uses: aws-actions/configure-aws-credentials@v3
140+
with:
141+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_CUMULUS_UAT }}
142+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_CUMULUS_UAT }}
143+
aws-region: us-west-2
153144

154145
- name: Aggregate failed jobs and print URLs and reasons
155146
env:
156147
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
157148
GITHUB_REPOSITORY: ${{ github.repository }}
158149
REGRESSION_ENV: ${{ needs.setup-and-chunk.outputs.environment_upper }}
150+
CMR_TOKEN_PROVIDER: lambda
151+
CMR_TOKEN_LAMBDA_FUNCTION_NAME: ${{ needs.setup-and-chunk.outputs.environment }}-launchpad_token_dispenser
152+
CMR_TOKEN_LAMBDA_REGION: us-west-2
159153
CMR_USER: ${{ secrets.CMR_USER }}
160154
CMR_PASS: ${{ secrets.CMR_PASS }}
161155
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
162-
CMR_BEARER_TOKEN: ${{ env.CMR_BEARER_TOKEN }}
163156
run: |
164-
poetry run python tests/aggregate_results.py
157+
poetry run python tests/aggregate_results.py

.github/workflows/process_chunk.yml

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,6 @@ jobs:
3636
include: ${{ fromJson(inputs.chunk-data) }}
3737
steps:
3838

39-
- name: Set CMR bearer token dynamically
40-
id: set-cmr-token
41-
run: |
42-
case "${{ inputs.environment }}" in
43-
UAT)
44-
echo "CMR_BEARER_TOKEN=${{ secrets.UAT_URS_TOKEN }}" >> $GITHUB_ENV
45-
;;
46-
OPS)
47-
echo "CMR_BEARER_TOKEN=${{ secrets.OPS_URS_TOKEN }}" >> $GITHUB_ENV
48-
;;
49-
*)
50-
echo "❌ Unknown environment: ${{ inputs.environment }}" >&2
51-
exit 1
52-
;;
53-
esac
54-
5539
- name: Get matrix job URL
5640
run: |
5741
echo "Fetching job URL for matrix job (env=${{ matrix.env }}, file=${{ matrix.file }})..."
@@ -135,14 +119,20 @@ jobs:
135119
- name: Poetry Install
136120
run: poetry install
137121

138-
- name: Run Regression
139-
id: regression
140-
env:
141-
CMR_BEARER_TOKEN: ${{ env.CMR_BEARER_TOKEN }}
122+
- name: Configure AWS credentials for UAT
123+
uses: aws-actions/configure-aws-credentials@v3
124+
with:
125+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_CUMULUS_UAT }}
126+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_CUMULUS_UAT }}
127+
aws-region: us-west-2
128+
129+
- name: Run Regression with Lambda Token Provider
130+
id: regression_with_token
142131
working-directory: tests
143132
run: |
144133
poetry run pytest -s -n 2 verify_collection.py \
145134
--env ${{ matrix.env }} \
135+
--token-provider lambda \
146136
--concept_id ${{ matrix.file }} \
147137
--tb=short | tee ../pytest_output.log
148138

.github/workflows/verify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
CMR_USER: ${{ secrets.CMR_USER }}
5757
CMR_PASS: ${{ secrets.CMR_PASS }}
5858
run: |
59-
poetry run pytest verify_collection.py --concept_id $CONCEPT_ID --env $TEST_ENV --junitxml=$GITHUB_WORKSPACE/test-results/test_report.xml --html=$GITHUB_WORKSPACE/test-results/test_report.html || true
59+
poetry run pytest verify_collection.py --concept_id $CONCEPT_ID --env $TEST_ENV --token-provider lambda --junitxml=$GITHUB_WORKSPACE/test-results/test_report.xml --html=$GITHUB_WORKSPACE/test-results/test_report.html || true
6060
6161
- name: Convert XML to JSON
6262
id: run-xml-to-json

0 commit comments

Comments
 (0)