Skip to content

Commit a0d08e8

Browse files
chore: synced file(s) with cds-snc/site-reliability-engineering (#1968)
* chore: synced local '.github/workflows/s3-backup.yml' with remote 'tools/sre_file_sync/s3-backup.yml' * chore: created local '.github/workflows/ossf-scorecard.yml' from remote 'tools/sre_file_sync/ossf-scorecard.yml' * chore: created local '.github/workflows/export_github_data.yml' from remote 'tools/sre_file_sync/export_github_data.yml' --------- Co-authored-by: sre-read-write[bot] <92993749+sre-read-write[bot]@users.noreply.github.com> Co-authored-by: Jumana B <[email protected]>
1 parent ec14c43 commit a0d08e8

File tree

3 files changed

+80
-2
lines changed

3 files changed

+80
-2
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: GitHub repository metadata exporter
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: "20 7 * * *"
6+
7+
jobs:
8+
export-data:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Audit DNS requests
12+
uses: cds-snc/dns-proxy-action@main
13+
env:
14+
DNS_PROXY_FORWARDTOSENTINEL: "true"
15+
DNS_PROXY_LOGANALYTICSWORKSPACEID: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
16+
DNS_PROXY_LOGANALYTICSSHAREDKEY: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }}
17+
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
18+
- name: Export Data
19+
uses: cds-snc/github-repository-metadata-exporter@main
20+
with:
21+
github-app-id: ${{ secrets.SRE_BOT_RO_APP_ID }}
22+
github-app-installation-id: ${{ secrets.SRE_BOT_RO_INSTALLATION_ID }}
23+
github-app-private-key: ${{ secrets.SRE_BOT_RO_PRIVATE_KEY }}
24+
log-analytics-workspace-id: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
25+
log-analytics-workspace-key: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Scorecards supply-chain security
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
# Weekly on Saturdays.
6+
- cron: "30 1 * * 6"
7+
push:
8+
branches:
9+
- main
10+
11+
permissions: read-all
12+
13+
jobs:
14+
analysis:
15+
name: Scorecards analysis
16+
runs-on: ubuntu-latest
17+
permissions:
18+
actions: read
19+
contents: read
20+
21+
steps:
22+
- name: "Checkout code"
23+
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
24+
with:
25+
persist-credentials: false
26+
27+
- name: "Run analysis"
28+
uses: ossf/scorecard-action@2dee8c185ea0de807198c818714b6f3436856709
29+
with:
30+
results_file: ossf-results.json
31+
results_format: json
32+
publish_results: false
33+
34+
- name: "Add metadata"
35+
run: |
36+
full_repo="${{ github.repository }}"
37+
OWNER=${full_repo%/*}
38+
REPO=${full_repo#*/}
39+
jq -c '. + {"metadata_owner": "'$OWNER'", "metadata_repo": "'$REPO'", "metadata_query": "ossf"}' ossf-results.json > ossf-results-modified.json
40+
41+
- name: "Post results to Sentinel"
42+
uses: cds-snc/sentinel-forward-data-action@main
43+
with:
44+
file_name: ossf-results-modified.json
45+
log_type: GitHubMetadata_OSSF_Scorecard
46+
log_analytics_workspace_id: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
47+
log_analytics_workspace_key: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }}

.github/workflows/s3-backup.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
fetch-depth: 0 # retrieve all history
1616

1717
- name: Configure AWS credentials
18-
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
18+
uses: aws-actions/configure-aws-credentials@8c3f20df09ac63af7b3ae3d7c91f105f857d8497 # v4.0.0
1919
with:
2020
aws-access-key-id: ${{ secrets.AWS_S3_BACKUP_ACCESS_KEY_ID }}
2121
aws-secret-access-key: ${{ secrets.AWS_S3_BACKUP_SECRET_ACCESS_KEY }}
@@ -30,4 +30,10 @@ jobs:
3030
3131
- name: Upload to S3 bucket
3232
run: |
33-
aws s3 sync . s3://${{ secrets.AWS_S3_BACKUP_BUCKET }} --exclude='*' --include='${{ github.repository }}/*'
33+
aws s3 sync . s3://${{ secrets.AWS_S3_BACKUP_BUCKET }} --exclude='*' --include='${{ github.repository }}/*'
34+
35+
- name: Notify Slack channel if this job failed
36+
if: ${{ failure() }}
37+
run: |
38+
json='{"text":"S3 backup failed in <https://github.com/${{ github.repository }}>!"}'
39+
curl -X POST -H 'Content-type: application/json' --data "$json" ${{ secrets.SLACK_NOTIFY_WEBHOOK }}

0 commit comments

Comments
 (0)