-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLOUDP-237043: Use seggregated secret envs
- Loading branch information
Showing
9 changed files
with
140 additions
and
95 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,108 +1,24 @@ | ||
name: Clean Atlas organization | ||
name: Clean All Atlas organizations | ||
|
||
on: | ||
schedule: | ||
- cron: "*/30 7-22 * * 1-5" | ||
workflow_dispatch: | ||
inputs: | ||
lifetime: | ||
description: "Lifetime of project in hours" | ||
type: number | ||
default: 1 | ||
required: true | ||
commercial: | ||
description: "Clean commercial Atlas environments" | ||
type: boolean | ||
default: true | ||
required: true | ||
government: | ||
description: "Clean government Atlas environments" | ||
type: boolean | ||
default: true | ||
required: true | ||
|
||
concurrency: | ||
group: cleanup | ||
|
||
jobs: | ||
calculate-targets: | ||
name: Calculate targets for execution | ||
runs-on: ubuntu-latest | ||
outputs: | ||
targets: ${{ steps.set-targets.outputs.targets }} | ||
steps: | ||
- id: set-targets | ||
name: Set Targets | ||
env: | ||
EVENT: ${{ github.event_name }} | ||
COMMERCIAL: ${{ inputs.commercial }} | ||
GOVERNMENT: ${{ inputs.government }} | ||
run: | | ||
if [ "$EVENT" == "schedule" ]; then | ||
echo 'targets=["CloudQA", "CloudGovQA"]' >> $GITHUB_OUTPUT | ||
exit 0 | ||
fi | ||
ENVS=() | ||
if [ "$COMMERCIAL" == true ]; then | ||
ENVS+=("CloudQA") | ||
fi | ||
if [ "$GOVERNMENT" == true ]; then | ||
ENVS+=("CloudGovQA") | ||
fi | ||
JSON=$(printf '%s\n' "${ENVS[@]}" | jq -R . | jq -cs .) | ||
echo "targets=$JSON" >> $GITHUB_OUTPUT | ||
cleanup: | ||
name: Cleanup Atlas Cloud | ||
runs-on: ubuntu-latest | ||
clean-tests: | ||
needs: | ||
- calculate-targets | ||
strategy: | ||
matrix: | ||
target: ${{ fromJSON(needs.calculate-targets.outputs.targets) }} | ||
steps: | ||
- name: Checkout codebase | ||
uses: actions/checkout@v4 | ||
- run-tests | ||
uses: ./.github/workflows/cleanup-test.yml | ||
|
||
- name: Install devbox | ||
uses: jetify-com/devbox-install-action@v0.11.0 | ||
with: | ||
enable-cache: 'true' | ||
|
||
- name: Build clean tool | ||
run: | | ||
devbox run -- 'cd tools/clean && go build .' | ||
- name: Persist GCP credentials | ||
id: gcp-cred | ||
env: | ||
GCP_SA_CRED: ${{ secrets.GCP_SA_CRED_NEW_TEST }} | ||
run: | | ||
echo $GCP_SA_CRED > ~/gcp_sa_cred.json | ||
echo credentials=$(realpath ~/gcp_sa_cred.json) >> $GITHUB_OUTPUT | ||
- name: Run cleaner | ||
env: | ||
MCLI_OPS_MANAGER_URL: ${{ matrix.target == 'CloudQA' && 'https://cloud-qa.mongodb.com/' || 'https://cloud-qa.mongodbgov.com/' }} | ||
MCLI_PUBLIC_API_KEY: ${{ matrix.target == 'CloudQA' && secrets.ATLAS_PUBLIC_KEY || secrets.ATLAS_GOV_PUBLIC_KEY}} | ||
MCLI_PRIVATE_API_KEY: ${{ matrix.target == 'CloudQA' && secrets.ATLAS_PRIVATE_KEY || secrets.ATLAS_GOV_PRIVATE_KEY }} | ||
MCLI_ORG_ID: ${{ matrix.target == 'CloudQA' && secrets.ATLAS_ORG_ID || secrets.ATLAS_GOV_ORG_ID }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
GOOGLE_APPLICATION_CREDENTIALS: ${{ steps.gcp-cred.outputs.credentials }} | ||
GOOGLE_PROJECT_ID: atlasoperator | ||
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID_NEW_TEST }} | ||
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | ||
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET_NEW_TEST }} | ||
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
AZURE_RESOURCE_GROUP_NAME: svet-test | ||
PROJECT_LIFETIME: ${{ inputs.lifetime || 1 }} | ||
run: | | ||
devbox run -- 'cd tools/clean && ./clean atlas' | ||
clean-gov-tests: | ||
needs: | ||
- clean-tests | ||
uses: ./.github/workflows/cleanup-gov-test.yml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Clean Atlas organization | ||
|
||
on: | ||
schedule: | ||
- cron: "*/87 7-22 * * 1-5" | ||
workflow_dispatch: | ||
inputs: | ||
lifetime: | ||
description: "Lifetime of project in hours" | ||
type: number | ||
default: 1 | ||
required: true | ||
|
||
concurrency: | ||
group: cleanup | ||
|
||
jobs: | ||
environment: gov-test | ||
cleanup: | ||
name: Cleanup Atlas Gov Cloud | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout codebase | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install devbox | ||
uses: jetify-com/devbox-install-action@v0.11.0 | ||
with: | ||
enable-cache: 'true' | ||
|
||
- name: Build clean tool | ||
run: | | ||
devbox run -- 'cd tools/clean && go build .' | ||
- name: Persist GCP credentials | ||
id: gcp-cred | ||
env: | ||
GCP_SA_CRED: ${{ secrets.GCP_SA_CRED }} | ||
run: | | ||
echo $GCP_SA_CRED > ~/gcp_sa_cred.json | ||
echo credentials=$(realpath ~/gcp_sa_cred.json) >> $GITHUB_OUTPUT | ||
- name: Run cleaner | ||
env: | ||
MCLI_OPS_MANAGER_URL: 'https://cloud-qa.mongodbgov.com/ | ||
MCLI_PUBLIC_API_KEY: ${{ secrets.ATLAS_GOV_PUBLIC_KEY }} | ||
MCLI_PRIVATE_API_KEY: ${{ secrets.ATLAS_GOV_PRIVATE_KEY }} | ||
MCLI_ORG_ID: ${{ secrets.ATLAS_GOV_ORG_ID }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
GOOGLE_APPLICATION_CREDENTIALS: ${{ steps.gcp-cred.outputs.credentials }} | ||
GOOGLE_PROJECT_ID: atlasoperator | ||
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID_NEW_TEST }} | ||
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | ||
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET_NEW_TEST }} | ||
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
AZURE_RESOURCE_GROUP_NAME: svet-test | ||
PROJECT_LIFETIME: ${{ inputs.lifetime || 1 }} | ||
run: | | ||
devbox run -- 'cd tools/clean && ./clean atlas' | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Clean Atlas organization | ||
|
||
on: | ||
schedule: | ||
- cron: "*/30 7-22 * * 1-5" | ||
workflow_dispatch: | ||
inputs: | ||
lifetime: | ||
description: "Lifetime of project in hours" | ||
type: number | ||
default: 1 | ||
required: true | ||
|
||
concurrency: | ||
group: cleanup | ||
|
||
jobs: | ||
environment: test | ||
cleanup: | ||
name: Cleanup Atlas Cloud | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout codebase | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install devbox | ||
uses: jetify-com/devbox-install-action@v0.11.0 | ||
with: | ||
enable-cache: 'true' | ||
|
||
- name: Build clean tool | ||
run: | | ||
devbox run -- 'cd tools/clean && go build .' | ||
- name: Persist GCP credentials | ||
id: gcp-cred | ||
env: | ||
GCP_SA_CRED: ${{ secrets.GCP_SA_CRED }} | ||
run: | | ||
echo $GCP_SA_CRED > ~/gcp_sa_cred.json | ||
echo credentials=$(realpath ~/gcp_sa_cred.json) >> $GITHUB_OUTPUT | ||
- name: Run cleaner | ||
env: | ||
MCLI_OPS_MANAGER_URL: 'https://cloud-qa.mongodb.com/' | ||
MCLI_PUBLIC_API_KEY: ${{ secrets.ATLAS_PUBLIC_KEY }} | ||
MCLI_PRIVATE_API_KEY: ${{ secrets.ATLAS_PRIVATE_KEY }} | ||
MCLI_ORG_ID: ${{ secrets.ATLAS_ORG_ID }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
GOOGLE_APPLICATION_CREDENTIALS: ${{ steps.gcp-cred.outputs.credentials }} | ||
GOOGLE_PROJECT_ID: atlasoperator | ||
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID_NEW_TEST }} | ||
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | ||
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET_NEW_TEST }} | ||
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
AZURE_RESOURCE_GROUP_NAME: svet-test | ||
PROJECT_LIFETIME: ${{ inputs.lifetime || 1 }} | ||
run: | | ||
devbox run -- 'cd tools/clean && ./clean atlas' | ||
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 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 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 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 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 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