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

clean CI jobs, Makefile and go.mod/Dockerfile #350

Merged
merged 4 commits into from
Jul 21, 2023
Merged

clean CI jobs, Makefile and go.mod/Dockerfile #350

merged 4 commits into from
Jul 21, 2023

Conversation

jaypipes
Copy link
Owner

harden and refactor GH action for unit tests

Updates the GH Action workflow for unit testing with security best
practices, including reduce permissions, the step security action
hardener, and using SHA-specific Action releases.

separate linter job in Github Actions

pulls out the golangci-lint job from the main go.yml Github Action and
into its own workflow that follows security best practices like ensuring
read-only permissions and using SHA-specific Action releases.

cleanup Makefile, Dockerfile, go.mod

Updates to Go 1.19 in go.mod to get us to a more modern Go release.
Similarly changes the Dockerfile that builds the `ghwc` binary to use Go
1.19 and use a hashed version of the Alpine base image to address
security best practices.

Finally, removes the outdated and unnecessary Make targets and
unnecessarily complicated calls to find Go packages. These targets and
fancy code was left over from before Go modules and when we were using
`dep` and vendoring things.

Adds a `.github/workflows/fmtcheck.yml` that follows GH actions security
best practices and separates the fmtcheck stuff from the other tests in
the main `.github.51.al/workflows/go.yml`.

remove old hack/check-format.sh and doc.go content

The hack/check-format.sh script is not used anywhere (and there is a
`make fmtcheck` target that accomplishes the same thing). So, removing
that.

Also remove all the duplicative (and out-of-date) documentation from the
`doc.go` file for two reasons:

1) pkg.go.dev now includes the README in its entirety and therefore
   there is not a need to duplicate the information from the README into
   a `doc.go` file.
2) Having two places for examples and docs just meant the information in
   `doc.go` quickly got out of date.

The hack/check-format.sh script is not used anywhere (and there is a
`make fmtcheck` target that accomplishes the same thing). So, removing
that.

Also remove all the duplicative (and out-of-date) documentation from the
`doc.go` file for two reasons:

1) pkg.go.dev now includes the README in its entirety and therefore
   there is not a need to duplicate the information from the README into
   a `doc.go` file.
2) Having two places for examples and docs just meant the information in
   `doc.go` quickly got out of date.

Signed-off-by: Jay Pipes <jaypipes@gmail.com>
@jaypipes jaypipes requested a review from ffromani July 21, 2023 04:14
@jaypipes jaypipes added this to the v1.0.0 milestone Jul 21, 2023
@jaypipes jaypipes force-pushed the prep-for-v1 branch 5 times, most recently from 1941ff9 to e9a0cea Compare July 21, 2023 04:41
Updates to Go 1.19 in go.mod to get us to a more modern Go release.
Similarly changes the Dockerfile that builds the `ghwc` binary to use Go
1.19 and use a hashed version of the Alpine base image to address
security best practices.

Finally, removes the outdated and unnecessary Make targets and
unnecessarily complicated calls to find Go packages. These targets and
fancy code was left over from before Go modules and when we were using
`dep` and vendoring things.

Adds a `.github/workflows/fmtcheck.yml` that follows GH actions security
best practices and separates the fmtcheck stuff from the other tests in
the main `.github.51.al/workflows/go.yml`.

Signed-off-by: Jay Pipes <jaypipes@gmail.com>
pulls out the golangci-lint job from the main go.yml Github Action and
into its own workflow that follows security best practices like ensuring
read-only permissions and using SHA-specific Action releases.

Signed-off-by: Jay Pipes <jaypipes@gmail.com>
Updates the GH Action workflow for unit testing with security best
practices, including reduce permissions, the step security action
hardener, and using SHA-specific Action releases.

Signed-off-by: Jay Pipes <jaypipes@gmail.com>
@jaypipes
Copy link
Owner Author

@ffromani this PR does a bunch of cleanup of our CI jobs (GH Action runners) in preparation for the v1 milestone. Most of the cleanup was around hardening of the workflows in accordance with security best practices from step-security. Feel free to review! :)

Comment on lines +9 to +22
permissions:
contents: read

jobs:
fmtcheck:
runs-on: ubuntu-latest
steps:
- name: harden runner
uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1
with:
egress-policy: block
disable-sudo: true
allowed-endpoints: >
github.com:443
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

Copy link
Collaborator

@ffromani ffromani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice work @jaypipes !

@ffromani ffromani merged commit 7a46924 into main Jul 21, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants