Skip to content

Commit 4a5ff5f

Browse files
chore: synced file(s) with cds-snc/site-reliability-engineering (#14)
* chore: synced local '.github/workflows/s3-backup.yml' with remote 'tools/sre_file_sync/s3-backup.yml' * chore: synced local '.github/workflows/export_github_data.yml' with remote 'tools/sre_file_sync/export_github_data.yml' * chore: synced local '.github/workflows/backstage-catalog-helper.yml' with remote 'tools/sre_file_sync/backstage-catalog-helper.yml' * chore: synced local '.github/workflows/ossf-scorecard.yml' with remote 'tools/sre_file_sync/ossf-scorecard.yml' --------- Co-authored-by: sre-read-write[bot] <92993749+sre-read-write[bot]@users.noreply.github.com>
1 parent a5aa574 commit 4a5ff5f

4 files changed

Lines changed: 36 additions & 18 deletions

File tree

.github/workflows/backstage-catalog-helper.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ jobs:
1010
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
1111
with:
1212
fetch-depth: 0
13+
persist-credentials: false
1314
- name: Run Backstage Catalog Info Helper
14-
uses: cds-snc/backstage-catalog-info-helper-action@v0.3.1
15+
uses: cds-snc/backstage-catalog-info-helper-action@cc75afc29a0ade6c41400132ff9e1222f8916ba6 # v0.3.1
1516
with:
1617
github_app_id: ${{ secrets.SRE_BOT_RW_APP_ID }}
1718
github_app_private_key: ${{ secrets.SRE_BOT_RW_PRIVATE_KEY }}

.github/workflows/export_github_data.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,37 @@ on:
44
schedule:
55
- cron: "20 7 * * *"
66

7+
permissions:
8+
id-token: write
9+
contents: read
10+
issues: read
11+
pull-requests: read
12+
security-events: read
13+
714
jobs:
815
export-data:
916
runs-on: ubuntu-latest
1017
steps:
1118
- name: Audit DNS requests
12-
uses: cds-snc/dns-proxy-action@main
19+
uses: cds-snc/dns-proxy-action@2aee21aebfddefac5839497648a36a9f84342d8b
1320
env:
1421
DNS_PROXY_FORWARDTOSENTINEL: "true"
1522
DNS_PROXY_LOGANALYTICSWORKSPACEID: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
1623
DNS_PROXY_LOGANALYTICSSHAREDKEY: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }}
1724
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
- name: Configure AWS credentials using OIDC
26+
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
27+
with:
28+
role-to-assume: arn:aws:iam::739275439843:role/data-lake-github-data-export
29+
role-session-name: GithubDataExport
30+
aws-region: ca-central-1
1831
- name: Export Data
19-
uses: cds-snc/github-repository-metadata-exporter@main
32+
uses: cds-snc/github-repository-metadata-exporter@531ae86f67b4c0aa1a40229571211ef73109bda2
2033
with:
2134
github-app-id: ${{ secrets.SRE_BOT_RO_APP_ID }}
2235
github-app-installation-id: ${{ secrets.SRE_BOT_RO_INSTALLATION_ID }}
2336
github-app-private-key: ${{ secrets.SRE_BOT_RO_PRIVATE_KEY }}
2437
log-analytics-workspace-id: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
2538
log-analytics-workspace-key: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }}
39+
s3-bucket: ${{ secrets.DATA_LAKE_GITHUB_METADATA_EXPORT_S3_BUCKET }}
40+
aws-region: ${{ secrets.DATA_LAKE_GITHUB_METADATA_EXPORT_AWS_REGION }}

.github/workflows/ossf-scorecard.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@ on:
88
branches:
99
- main
1010

11-
permissions: read-all
11+
permissions:
12+
contents: read
13+
issues: read
14+
pull-requests: read
15+
checks: read
16+
actions: read
1217

1318
jobs:
1419
analysis:
1520
name: Scorecards analysis
1621
runs-on: ubuntu-latest
17-
permissions:
18-
actions: read
19-
contents: read
2022

2123
steps:
2224
- name: "Checkout code"
@@ -39,7 +41,7 @@ jobs:
3941
jq -c '. + {"metadata_owner": "'$OWNER'", "metadata_repo": "'$REPO'", "metadata_query": "ossf"}' ossf-results.json > ossf-results-modified.json
4042
4143
- name: "Post results to Sentinel"
42-
uses: cds-snc/sentinel-forward-data-action@main
44+
uses: cds-snc/sentinel-forward-data-action@01db4a9203054ecdb60ff368c3cdfca71d62e85f
4345
with:
4446
file_name: ossf-results-modified.json
4547
log_type: GitHubMetadata_OSSF_Scorecard

.github/workflows/s3-backup.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
schedule:
55
- cron: "0 6 * * *"
66

7+
permissions:
8+
id-token: write
9+
contents: read
10+
711
jobs:
812
s3-backup:
913
runs-on: ubuntu-latest
@@ -13,24 +17,20 @@ jobs:
1317
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1418
with:
1519
fetch-depth: 0 # retrieve all history
20+
persist-credentials: false
1621

1722
- name: Configure AWS credentials
18-
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0
23+
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5.1.0
1924
with:
20-
aws-access-key-id: ${{ secrets.AWS_S3_BACKUP_ACCESS_KEY_ID }}
21-
aws-secret-access-key: ${{ secrets.AWS_S3_BACKUP_SECRET_ACCESS_KEY }}
25+
role-to-assume: ${{ secrets.AWS_S3_BACKUP_IAM_ROLE_ARN }}
26+
role-session-name: S3Backup
2227
aws-region: ca-central-1
2328

24-
- name: Create ZIP bundle
29+
- name: Upload zip to S3 bucket
2530
run: |
2631
ZIP_FILE=`basename ${{ github.repository }}`-`date '+%Y-%m-%d'`.zip
2732
zip -rq "${ZIP_FILE}" .
28-
mkdir -p ${{ github.repository }}
29-
mv "${ZIP_FILE}" ${{ github.repository }}
30-
31-
- name: Upload to S3 bucket
32-
run: |
33-
aws s3 sync . s3://${{ secrets.AWS_S3_BACKUP_BUCKET }} --exclude='*' --include='${{ github.repository }}/*'
33+
aws s3 cp "${ZIP_FILE}" s3://${{ secrets.AWS_S3_BACKUP_BUCKET }}/${{ github.repository }}/"${ZIP_FILE}"
3434
3535
- name: Notify Slack channel if this job failed
3636
if: ${{ failure() }}

0 commit comments

Comments
 (0)