mirror of
https://github.com/anchore/grype
synced 2024-09-20 06:21:56 +00:00
chore: update codeql to pinned v2 with correct write permissions
This commit is contained in:
parent
8f28a6ea96
commit
02fe5e9c76
3 changed files with 44 additions and 17 deletions
54
.github/workflows/codeql-analysis.yml
vendored
54
.github/workflows/codeql-analysis.yml
vendored
|
@ -3,25 +3,32 @@
|
|||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
name: "CodeQL Security Scan"
|
||||
name: CodeQL Security Scan
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
# only run when there are pushes to the main branch (not on PRs)
|
||||
- main
|
||||
paths:
|
||||
- '**'
|
||||
- '!**.md'
|
||||
- '!LICENSE'
|
||||
- '!test/**'
|
||||
branches: [ main ]
|
||||
|
||||
schedule:
|
||||
- cron: '0 14 * * 4'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
CODEQL_EXTRACTOR_GO_BUILD_TRACING: on
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
# required for all workflows
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
@ -33,22 +40,37 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
|
||||
|
||||
- name: Utilize Go Module Cache
|
||||
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11
|
||||
with:
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
~/.cache/go-build
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
|
||||
- name: Set correct version of Golang to use during CodeQL run
|
||||
uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f # v3.3.1
|
||||
with:
|
||||
go-version: '1.18'
|
||||
check-latest: true
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
uses: github/codeql-action/init@c3b6fce4ee2ca25bc1066aa3bf73962fda0e8898 # v2.1.31
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
# - name: Autobuild
|
||||
# uses: github/codeql-action/autobuild@v2
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
@ -56,10 +78,8 @@ jobs:
|
|||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
- name: Build grype for CodeQL
|
||||
run: make grype
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
uses: github/codeql-action/analyze@c3b6fce4ee2ca25bc1066aa3bf73962fda0e8898 # v2.1.31
|
||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -25,6 +25,8 @@ coverage.txt
|
|||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
/grype/grype
|
||||
|
||||
|
||||
# Test binary, build with `go test -c`
|
||||
*.test
|
||||
|
|
5
Makefile
5
Makefile
|
@ -79,6 +79,11 @@ endef
|
|||
all: clean static-analysis test ## Run all checks (linting, license check, unit, integration, and linux acceptance tests tests)
|
||||
@printf '$(SUCCESS)All checks pass!$(RESET)\n'
|
||||
|
||||
.PHONY: grype
|
||||
grype: ## Build the grype binary
|
||||
@printf '$(TITLE)Building grype$(RESET)\n'
|
||||
CGO_ENABLED=0 go build -o $@ -trimpath -ldflags "-X main.version=$(VERSION) -X main.syftVersion=$(SYFT_VERSION)"
|
||||
|
||||
.PHONY: test
|
||||
test: unit validate-cyclonedx-schema validate-cyclonedx-vex-schema integration cli ## Run all tests (unit, integration, linux acceptance, and CLI tests)
|
||||
|
||||
|
|
Loading…
Reference in a new issue