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

CI hardening #187

Merged
merged 5 commits into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 9 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@ on:
tags:
- "*"

permissions:
contents: read
packages: write

env:
REGISTRY: ghcr.io
IMAGE_NAME: datadog/stratus-red-team

permissions:
contents: read

jobs:
docker-build-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@v1
uses: step-security/harden-runner@dd2c410b088af7c0dc8046f3ac9a8f4148492a95
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs

Expand All @@ -28,14 +30,14 @@ jobs:
fetch-depth: 0

- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2.0.0
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v3.1.1
uses: docker/build-push-action@c84f38281176d4c9cdb1626ffafcd6b3911b5d94
with:
context: .
push: true
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ on:
- "docs/**"
- mkdocs.yml
- "tools/**"

permissions:
contents: read

jobs:
deploy:
permissions:
contents: write # for mkdocs gh-deploy to publish docs
runs-on: ubuntu-latest
steps:
- name: Harden Runner
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@ on:
tags:
- "*"

permissions:
contents: write

defaults:
run:
working-directory: ./v2

permissions:
contents: read

jobs:
goreleaser:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@v1
uses: step-security/harden-runner@dd2c410b088af7c0dc8046f3ac9a8f4148492a95
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs

Expand All @@ -26,12 +28,12 @@ jobs:
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@bfdd3570ce990073878bf10f6b2d79082de49492
with:
go-version: 1.18
- name: Run GoReleaser
timeout-minutes: 60
uses: goreleaser/goreleaser-action@v3
uses: goreleaser/goreleaser-action@ff11ca24a9b39f2d36796d1fbd7a4e39c182630a
with:
distribution: goreleaser
version: latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
branches:
- main

permissions:
contents: read

jobs:
static-analysis:
name: "Run Go static analysis"
Expand Down