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

Cleanup ci and add trivy #1239

Merged
merged 15 commits into from
Jun 14, 2024
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: Check signed commits in PR
on:
pull_request_target:
pull_request:
name: Check signed commits
on: pull_request_target

jobs:
check-signed-commits:
Expand All @@ -12,4 +10,4 @@ jobs:
pull-requests: write
steps:
- name: Check signed commits in PR
uses: 1Password/check-signed-commits-action@v1
uses: 1Password/check-signed-commits-action@v1
78 changes: 54 additions & 24 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,73 @@ on:
workflow_call:
workflow_dispatch:


jobs:
# lint:
# runs-on: ubuntu-20.04
# continue-on-error: true
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-go@v4
# with:
# go-version-file: 'go.mod'
# - name: golangci-lint
# uses: golangci/golangci-lint-action@v3
# with:
# # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
# version: latest
# skip-pkg-cache: true
# skip-build-cache: true
security_scan:
name: Security Scan
runs-on: ubuntu-22.04
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0

# TODO(ale8k): Currently hanging forever, not sure why?
# - name: Run govulncheck
# uses: golang/govulncheck-action@v1

- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/[email protected]
with:
scan-type: 'fs'
ignore-unfixed: true
format: 'table'
# output: 'trivy-results.sarif' # TODO(ale8k) Turn on when uploading to gh and change above line to sarif
severity: 'CRITICAL'
exit-code: '1'

# TODO(ale8k): Setup GH security
# - name: Upload Trivy scan results to GitHub Security tab
# uses: github/codeql-action/upload-sarif@v2
# with:
# sarif_file: 'trivy-results.sarif'

build_test:
name: Build and Test
runs-on: ubuntu-22.04
timeout-minutes: 45
needs: [security_scan]
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0
- uses: actions/setup-go@v4

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'

- name: Install dependencies
run: sudo apt-get update -y && sudo apt-get install -y gcc git-core gnupg build-essential
- run: sudo snap install juju-db --channel 4.4/stable

- name: Install juju-db
run: sudo snap install juju-db --channel 4.4/stable

- name: Add volume files
run: |
touch ./local/vault/approle.json
touch ./local/vault/roleid.txt
touch ./local/vault/vault.env

- name: Create test certs
run: make certs

- name: Start test environment
run: docker compose up -d --wait

- name: Build and Test
run: go test -mod readonly ./... -timeout 1h -cover
env:
Expand All @@ -60,18 +85,23 @@ jobs:
smoke_test:
name: Smoke Test
runs-on: ubuntu-22.04
needs: [security_scan]
# The docker compose has a healthcheck on the JIMM container.
# So if the compose returns with exit code 0 then the JIMM server successfully started.
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'

- name: Add volume files
run: |
touch ./local/vault/approle.json
touch ./local/vault/roleid.txt
touch ./local/vault/vault.env
- run: go version
- run: go mod vendor
- run: docker compose --profile dev up -d --wait --timestamps

- name: Run Smoke Test
run: docker compose --profile dev up -d --wait --timestamps
15 changes: 0 additions & 15 deletions .github/workflows/jaas-snap-release.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/jimmctl-snap-release.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Publish the OCI image to ghcr
name: Publish server image
name: Release Server ROCK

on:
# Note that when running via workflow_dispatch, the github.ref_name
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/release-snaps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release Snaps

on:
workflow_dispatch:
push:
tags:
- 'v3*'

jobs:
build-and-release-jimmctl:
uses: ./.github/workflows/snap-release.yaml
ale8k marked this conversation as resolved.
Show resolved Hide resolved
with:
folder: jimmctl
release-channel: 3/edge
secrets: inherit

build-and-release-jaas-plugin:
uses: ./.github/workflows/snap-release.yaml
ale8k marked this conversation as resolved.
Show resolved Hide resolved
with:
folder: jaas
release-channel: 3/edge
secrets: inherit

build-and-release-jimm-server:
uses: ./.github/workflows/snap-release.yaml
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a composite workflow, cannot be named

with:
jobs: build # Only build, this snap isn't released to snapcraft
folder: jimm
release-channel: 3/edge # Not used for this snap
secrets: inherit

4 changes: 3 additions & 1 deletion .github/workflows/snap-release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: Release snap
# Release Snap is a composite workflow used within other workflows
# to reuse the logic of building and publishing a snap in one.
name: Release Snap

on:
workflow_call:
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/snap.yaml

This file was deleted.

Loading