Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(NODE-6161): Sign Releases #177

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
13f958b
feat(NODE-6161): sign kerberos releases
aditi-khare-mongoDB May 29, 2024
c2af477
fix tar sign
aditi-khare-mongoDB Jun 6, 2024
ff96c3b
add build steps
aditi-khare-mongoDB Jun 7, 2024
651755e
fix inputs
aditi-khare-mongoDB Jun 7, 2024
80d729c
fix path
aditi-khare-mongoDB Jun 10, 2024
9ca0176
added docker
aditi-khare-mongoDB Jun 18, 2024
a07c524
Merge branch 'main' into NODE-6161/sign-releases
aditi-khare-mongoDB Jun 18, 2024
11c2861
remove msc comment
aditi-khare-mongoDB Jun 18, 2024
e44fc79
remove unnecesary bash
aditi-khare-mongoDB Jun 18, 2024
3964184
typo
aditi-khare-mongoDB Jun 18, 2024
893eb52
typo another one
aditi-khare-mongoDB Jun 18, 2024
87288ec
copy over prebuild file?
aditi-khare-mongoDB Jun 18, 2024
b0bfdfe
move location?
aditi-khare-mongoDB Jun 18, 2024
8b8e8bb
add token
aditi-khare-mongoDB Jun 18, 2024
e2bd188
fixed script?
aditi-khare-mongoDB Jun 18, 2024
1756fb0
not glibc anymore
aditi-khare-mongoDB Jun 18, 2024
a2581b2
directly copy over durrans changes from mongodb-client-encryption
aditi-khare-mongoDB Jun 20, 2024
3d393b0
fix
aditi-khare-mongoDB Jun 20, 2024
b24e792
fix dockerfile
aditi-khare-mongoDB Jun 20, 2024
738d419
requested changes
aditi-khare-mongoDB Jun 20, 2024
c2802b9
fix typo
aditi-khare-mongoDB Jun 20, 2024
0e146d0
fix typo 2
aditi-khare-mongoDB Jun 20, 2024
8047bf8
ready me updates
aditi-khare-mongoDB Jun 20, 2024
221c60d
back to aptitude
aditi-khare-mongoDB Jun 20, 2024
6c820aa
remove install latest
aditi-khare-mongoDB Jun 20, 2024
5e717a8
update prebuild
aditi-khare-mongoDB Jun 20, 2024
6add6d9
add override
aditi-khare-mongoDB Jun 20, 2024
aeb43fc
reinstall deps
aditi-khare-mongoDB Jun 20, 2024
6d4c6e6
fix dep
aditi-khare-mongoDB Jun 20, 2024
66ca5c3
add comma
aditi-khare-mongoDB Jun 20, 2024
09d321f
fix apt
aditi-khare-mongoDB Jun 20, 2024
21d67be
add in new scripts
aditi-khare-mongoDB Jun 20, 2024
0bb729c
revert line
aditi-khare-mongoDB Jun 20, 2024
266fddc
skip incompatible tests on mac
aditi-khare-mongoDB Jun 21, 2024
2068b6f
remove testing support
aditi-khare-mongoDB Jun 21, 2024
677976b
remove testing support 2
aditi-khare-mongoDB Jun 21, 2024
02c941b
add prebuild
aditi-khare-mongoDB Jun 21, 2024
0d2811a
test run
aditi-khare-mongoDB Jun 21, 2024
b552e92
test run fix
aditi-khare-mongoDB Jun 21, 2024
5ad3d75
test run fix 2
aditi-khare-mongoDB Jun 21, 2024
41f44ff
fix?
aditi-khare-mongoDB Jun 21, 2024
f7e3481
maybe
aditi-khare-mongoDB Jun 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ runs:
registry-url: 'https://registry.npmjs.org'
- run: npm install -g npm@latest
shell: bash
- run: npm clean-install
- run: npm clean-install --ignore-scripts
shell: bash
71 changes: 71 additions & 0 deletions .github/actions/sign_and_upload/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Sign and Upload Package
description: 'Signs native modules with garasign'

inputs:
aws_role_arn:
description: 'AWS role input for drivers-github-tools/gpg-sign@v2'
required: true
aws_region_name:
description: 'AWS region name input for drivers-github-tools/gpg-sign@v2'
required: true
aws_secret_id:
description: 'AWS secret id input for drivers-github-tools/gpg-sign@v2'
required: true
npm_package_name:
description: 'The name for the npm package this repository represents'
required: true

runs:
using: composite
steps:
- uses: actions/download-artifact@v4

- name: Make signatures directory
shell: bash
run: mkdir artifacts

- name: Set up drivers-github-tools
uses: mongodb-labs/drivers-github-tools/setup@v2
with:
aws_region_name: ${{ inputs.aws_region_name }}
aws_role_arn: ${{ inputs.aws_role_arn }}
aws_secret_id: ${{ inputs.aws_secret_id }}

- name: Create detached signature
uses: mongodb-labs/drivers-github-tools/gpg-sign@v2
with:
filenames: 'build-*/*.tar.gz'
env:
RELEASE_ASSETS: artifacts/

- name: Copy the tarballs to the artifacts directory
shell: bash
run: for filename in build-*/*.tar.gz; do cp ${filename} artifacts/; done

- run: npm pack
shell: bash

- name: Get release version and release package file name
id: get_vars
shell: bash
run: |
package_version=$(jq --raw-output '.version' package.json)
echo "package_version=${package_version}" >> "$GITHUB_OUTPUT"
echo "package_file=${{ inputs.npm_package_name }}-${package_version}.tgz" >> "$GITHUB_OUTPUT"

- name: Create detached signature for module
uses: mongodb-labs/drivers-github-tools/gpg-sign@v2
with:
filenames: ${{ steps.get_vars.outputs.package_file }}
env:
RELEASE_ASSETS: artifacts/

- name: Display structure of downloaded files
shell: bash
run: ls -la artifacts/

- name: "Upload release artifacts"
run: gh release upload v${{ steps.get_vars.outputs.package_version }} artifacts/*.*
shell: bash
env:
GH_TOKEN: ${{ github.token }}
12 changes: 12 additions & 0 deletions .github/docker/Dockerfile.glibc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG NODE_BUILD_IMAGE=node:16.20.1-bullseye
FROM $NODE_BUILD_IMAGE AS build

WORKDIR /kerberos
COPY . .

RUN npm run install kerberos
aditi-khare-mongoDB marked this conversation as resolved.
Show resolved Hide resolved
RUN npm run test

FROM scratch

COPY --from=build /kerberos/prebuilds/ /
100 changes: 100 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch: {}

name: Build and Test

permissions:
contents: write
pull-requests: write
id-token: write

jobs:
host_builds:
strategy:
matrix:
os: [macos-11, macos-latest, windows-2019]
aditi-khare-mongoDB marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

aditi-khare-mongoDB marked this conversation as resolved.
Show resolved Hide resolved
- name: Build ${{ matrix.os }} Prebuild
run: npm run prebuild
shell: bash

- name: Test ${{ matrix.os }}
shell: bash
run: npm run test

- id: upload
name: Upload prebuild
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.os }}
path: prebuilds/
if-no-files-found: 'error'
retention-days: 1
compression-level: 0

container_builds:
outputs:
artifact_id: ${{ steps.upload.outputs.artifact-id }}
runs-on: ubuntu-latest
strategy:
matrix:
linux_arch: [s390x, arm64, amd64]
steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Run Buildx
run: |
docker buildx create --name builder --bootstrap --use
docker buildx build --platform linux/${{ matrix.linux_arch }} --output type=local,dest=./prebuilds,platform-split=false -f ./.github/docker/Dockerfile.glibc .

- id: upload
name: Upload prebuild
uses: actions/upload-artifact@v4
with:
name: build-linux-${{ matrix.linux_arch }}
path: prebuilds/
if-no-files-found: 'error'
retention-days: 1
compression-level: 0

release_please:
needs: [host_builds, container_builds]
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
steps:
- id: release
uses: googleapis/release-please-action@v4

sign_and_upload:
needs: [release_please]
if: ${{ needs.release_please.outputs.release_created }}
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v4
- name: actions/setup
uses: ./.github/actions/setup
- name: actions/sign_and_upload_package
uses: ./.github/actions/sign_and_upload_package
with:
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
aws_region_name: 'us-east-1'
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
npm_package_name: 'kerberos'
- run: npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
103 changes: 0 additions & 103 deletions .github/workflows/release.yml

This file was deleted.

17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,23 @@ Now you can install `kerberos` with the following:
npm install kerberos
```

### Release Integrity

The GitHub release contains a detached signature file for the NPM package (named
`kerberos-X.Y.Z.tgz.sig`).

The following command returns the link npm package.
```shell
npm view kerberos@vX.Y.Z dist.tarball
```

Using the result of the above command, a `curl` command can return the official npm package for the release.

To verify the integrity of the downloaded package, run the following command:
```shell
gpg --verify kerberos-X.Y.Z.tgz.sig kerberos-X.Y.Z.tgz
```

### Testing

Run the test suite using:
Expand Down
Loading