Skip to content

Commit 9130e09

Browse files
ssdlc compliance, minus sbom generation
1 parent 1f5d58d commit 9130e09

File tree

4 files changed

+98
-161
lines changed

4 files changed

+98
-161
lines changed

.github/actions/setup/action.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/actions/sign_and_upload_package/action.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ runs:
2828
shell: bash
2929
run: mkdir artifacts
3030

31+
- name: Load version and package info
32+
uses: baileympearson/drivers-github-tools/node/get_version_info@add-signing-env-action-for-node
33+
34+
3135
- name: Set up drivers-github-tools
3236
uses: mongodb-labs/drivers-github-tools/setup@v2
3337
with:
@@ -49,18 +53,10 @@ runs:
4953
- run: npm pack
5054
shell: bash
5155

52-
- name: Get release version and release package file name
53-
id: get_vars
54-
shell: bash
55-
run: |
56-
package_version=$(jq --raw-output '.version' package.json)
57-
echo "package_version=${package_version}" >> "$GITHUB_OUTPUT"
58-
echo "package_file=${{ inputs.npm_package_name }}-${package_version}.tgz" >> "$GITHUB_OUTPUT"
59-
6056
- name: Create detached signature for module
6157
uses: mongodb-labs/drivers-github-tools/gpg-sign@v2
6258
with:
63-
filenames: ${{ steps.get_vars.outputs.package_file }}
59+
filenames: ${{ env.package_file }}
6460
env:
6561
RELEASE_ASSETS: artifacts/
6662

@@ -70,7 +66,7 @@ runs:
7066

7167
- name: "Upload release artifacts"
7268
if: ${{ inputs.dry_run == false }}
73-
run: gh release upload v${{ steps.get_vars.outputs.package_version }} artifacts/*.*
69+
run: gh release upload v${{ env.package_version }} artifacts/*.*
7470
shell: bash
7571
env:
7672
GH_TOKEN: ${{ github.token }}

.github/workflows/build.yml

Lines changed: 1 addition & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -70,139 +70,4 @@ jobs:
7070
retention-days: 1
7171
compression-level: 0
7272

73-
release_please:
74-
needs: [host_builds, container_builds]
75-
runs-on: ubuntu-latest
76-
outputs:
77-
release_created: ${{ steps.release.outputs.release_created }}
78-
steps:
79-
- id: release
80-
uses: googleapis/release-please-action@v4
81-
82-
generate_sarif_report:
83-
environment: release
84-
runs-on: ubuntu-latest
85-
needs: [release_please]
86-
permissions:
87-
# required for all workflows
88-
security-events: write
89-
id-token: write
90-
contents: write
91-
92-
steps:
93-
- uses: actions/checkout@v4
94-
- name: Set up drivers-github-tools
95-
uses: mongodb-labs/drivers-github-tools/setup@v2
96-
with:
97-
aws_region_name: us-east-1
98-
aws_role_arn: ${{ secrets.aws_role_arn }}
99-
aws_secret_id: ${{ secrets.aws_secret_id }}
100-
101-
- name: "Generate Sarif Report"
102-
uses: mongodb-labs/drivers-github-tools/code-scanning-export@v2
103-
with:
104-
ref: main
105-
output-file: sarif-report.json
106-
107-
- name: Get release version and release package file name
108-
id: get_version
109-
shell: bash
110-
run: |
111-
package_version=$(jq --raw-output '.version' package.json)
112-
echo "package_version=${package_version}" >> "$GITHUB_OUTPUT"
113-
- name: actions/publish_asset_to_s3
114-
uses: mongodb-labs/drivers-github-tools/node/publish_asset_to_s3@v2
115-
with:
116-
version: ${{ steps.get_version.outputs.package_version }}
117-
product_name: mongodb-client-encryption
118-
file: sarif-report.json
119-
dry_run: ${{ needs.release_please.outputs.release_created == '' }}
120-
121-
generate_compliance_report:
122-
environment: release
123-
runs-on: ubuntu-latest
124-
needs: [release_please]
125-
permissions:
126-
# required for all workflows
127-
security-events: write
128-
id-token: write
129-
contents: write
130-
131-
steps:
132-
- uses: actions/checkout@v4
133-
- name: Set up drivers-github-tools
134-
uses: mongodb-labs/drivers-github-tools/setup@v2
135-
with:
136-
aws_region_name: us-east-1
137-
aws_role_arn: ${{ secrets.aws_role_arn }}
138-
aws_secret_id: ${{ secrets.aws_secret_id }}
139-
140-
- name: Get release version and release package file name
141-
id: get_version
142-
shell: bash
143-
run: |
144-
package_version=$(jq --raw-output '.version' package.json)
145-
echo "package_version=${package_version}" >> "$GITHUB_OUTPUT"
146-
147-
- name: Generate compliance report
148-
uses: mongodb-labs/drivers-github-tools/compliance-report@v2
149-
with:
150-
sbom_name: sbom.json # TODO - confirm sbom file name
151-
sarif_name: sarif-report.json
152-
security_report_location: tbd
153-
release_version: ${{ steps.get_version.outputs.package_version }}
154-
token: ${{ github.token }}
155-
156-
- name: actions/publish_asset_to_s3
157-
uses: mongodb-labs/drivers-github-tools/node/publish_asset_to_s3@v2
158-
with:
159-
version: ${{ steps.get_version.outputs.package_version }}
160-
product_name: mongodb-client-encryption
161-
file: ${{env.S3_ASSETS}}/ssdlc_compliance_report.txt
162-
dry_run: ${{ needs.release_please.outputs.release_created == '' }}
163-
164-
sign_and_upload:
165-
needs: [release_please]
166-
runs-on: ubuntu-latest
167-
environment: release
168-
steps:
169-
- uses: actions/checkout@v4
170-
- name: actions/setup
171-
uses: ./.github/actions/setup
172-
- name: Get release version and release package file name
173-
id: get_vars
174-
shell: bash
175-
run: |
176-
package_version=$(jq --raw-output '.version' package.json)
177-
echo "package_version=${package_version}" >> "$GITHUB_OUTPUT"
178-
echo "package_file=mongodb-${package_version}.tgz" >> "$GITHUB_OUTPUT"
179-
- name: actions/sign_and_upload_package
180-
uses: ./.github/actions/sign_and_upload_package
181-
with:
182-
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
183-
aws_region_name: 'us-east-1'
184-
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
185-
npm_package_name: 'mongodb-client-encryption'
186-
dry_run: ${{ needs.release_please.outputs.release_created == '' }}
187-
188-
- name: Generate authorized pub report
189-
uses: mongodb-labs/drivers-github-tools/authorized-pub@v2
190-
with:
191-
release_version: ${{ steps.get_version.outputs.package_version }}
192-
product_name: mongodb-client-encryption
193-
# <package> and <package>.sig
194-
filenames: artifacts/*
195-
token: ${{ github.token }}
196-
197-
- name: actions/publish_asset_to_s3
198-
uses: mongodb-labs/drivers-github-tools/node/publish_asset_to_s3@v2
199-
with:
200-
version: ${{ steps.get_version.outputs.package_version }}
201-
product_name: mongodb-client-encryption
202-
file: ${{env.S3_ASSETS}}/authorized-publication.txt
203-
dry_run: ${{ needs.release_please.outputs.release_created == '' }}
204-
205-
- run: npm publish --provenance --tag=alpha
206-
if: ${{ needs.release_please.outputs.release_created }}
207-
env:
208-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
73+

.github/workflows/release.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
on:
2+
push:
3+
branches: [main]
4+
pull_request:
5+
branches: [main]
6+
workflow_dispatch: {}
7+
8+
name: Build and Test
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
id-token: write
14+
15+
jobs:
16+
release_please:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
release_created: ${{ steps.release.outputs.release_created }}
20+
steps:
21+
- id: release
22+
uses: googleapis/release-please-action@v4
23+
24+
build:
25+
needs: [release_please]
26+
name: "Build native code"
27+
uses: ./.github/workflows/build.yml
28+
29+
ssdlc:
30+
needs: [release_please, build]
31+
permissions:
32+
# required for all workflows
33+
security-events: write
34+
id-token: write
35+
contents: write
36+
environment: release
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- name: Install Node and dependencies
42+
uses: baileympearson/drivers-github-tools/node/setup@add-signing-env-action-for-node
43+
44+
- name: Load version and package info
45+
uses: baileympearson/drivers-github-tools/node/get_version_info@add-signing-env-action-for-node
46+
47+
- name: actions/sign_and_upload_package
48+
uses: ./.github/actions/sign_and_upload_package
49+
with:
50+
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
51+
aws_region_name: 'us-east-1'
52+
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
53+
npm_package_name: 'mongodb-client-encryption'
54+
dry_run: ${{ needs.release_please.outputs.release_created == '' }}
55+
56+
- name: Copy sbom file to release assets
57+
shell: bash
58+
run: cp sbom.json ${{ env.S3_ASSETS }}/sbom.json
59+
60+
- name: Generate authorized pub report
61+
uses: mongodb-labs/drivers-github-tools/full-report@v2
62+
with:
63+
release_version: ${{ env.package_version }}
64+
product_name: mongodb-client-encryption
65+
sarif_report_target_ref: main
66+
third_party_dependency_tool: Silk
67+
# <package> and <package>.sig
68+
dist_filenames: ${{ env.package_file }}*
69+
token: ${{ github.token }}
70+
sbom_file_name: sbom.json
71+
72+
- uses: mongodb-labs/drivers-github-tools/upload-s3-assets@v2
73+
with:
74+
version: ${{ env.package_version }}
75+
product_name: mongodb-client-encryption
76+
dry_run: ${{ needs.release_please.outputs.release_created == '' }}
77+
78+
publish:
79+
needs: [release_please, ssdlc, build]
80+
environment: release
81+
runs-on: ubuntu-latest
82+
steps:
83+
- uses: actions/checkout@v4
84+
85+
- name: Install Node and dependencies
86+
uses: baileympearson/drivers-github-tools/node/setup@add-signing-env-action-for-node
87+
88+
# - run: npm publish --provenance --tag=latest
89+
# if: ${{ needs.release_please.outputs.release_created }}
90+
# env:
91+
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)