From e738c4b7c44353af52473d0392f224d5be08d53a Mon Sep 17 00:00:00 2001 From: Bradley Jones Date: Tue, 31 Jan 2023 14:20:43 +0000 Subject: [PATCH 1/3] feat: update golang to 1.19 Signed-off-by: Bradley Jones --- .github/actions/bootstrap/action.yaml | 2 +- .github/workflows/release.yaml | 2 +- .github/workflows/update-bootstrap-tools.yml | 2 +- .github/workflows/update-stereoscope-release.yml | 2 +- CONTRIBUTING.md | 4 ++-- go.mod | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/actions/bootstrap/action.yaml b/.github/actions/bootstrap/action.yaml index cd3d1c6c70f8..112037f00e48 100644 --- a/.github/actions/bootstrap/action.yaml +++ b/.github/actions/bootstrap/action.yaml @@ -4,7 +4,7 @@ inputs: go-version: description: "Go version to install" required: true - default: "1.18.x" + default: "1.19.x" use-go-cache: description: "Restore go cache" required: true diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6dcd5bc38063..c87a8dae7589 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -9,7 +9,7 @@ on: - "v*" env: - GO_VERSION: "1.18.x" + GO_VERSION: "1.19.x" jobs: quality-gate: diff --git a/.github/workflows/update-bootstrap-tools.yml b/.github/workflows/update-bootstrap-tools.yml index b013b4a2362f..1b5c6bc3fd58 100644 --- a/.github/workflows/update-bootstrap-tools.yml +++ b/.github/workflows/update-bootstrap-tools.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: env: - GO_VERSION: "1.18.x" + GO_VERSION: "1.19.x" GO_STABLE_VERSION: true jobs: diff --git a/.github/workflows/update-stereoscope-release.yml b/.github/workflows/update-stereoscope-release.yml index 7adc7ac981bc..62fcbb27912e 100644 --- a/.github/workflows/update-stereoscope-release.yml +++ b/.github/workflows/update-stereoscope-release.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: env: - GO_VERSION: "1.18.x" + GO_VERSION: "1.19.x" GO_STABLE_VERSION: true jobs: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dc02ce2ab19c..fae74a58797c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -# Contributing to Syft +[#](#) Contributing to Syft If you are looking to contribute to this project and want to open a GitHub pull request ("PR"), there are a few guidelines of what we are looking for in patches. Make sure you go through this document and ensure that your code proposal is aligned. @@ -10,7 +10,7 @@ Before you can contribute to Syft, you need to configure your development enviro You will need to install Go. The version on https://go.dev works best, using the system golang doesn't always work the way you might expect. -At the time of writing, Go 1.19 does not work correctly with Syft. Please use Go 1.18 for now. +Refer to the go.mod file in the root of this repo for the recommended version of Go to install. You will also need Docker. There's no reason the system packages shouldn't work, but we used the official Docker package. You can find instructions for installing Docker in Debian [here](https://docs.docker.com/engine/install/debian/). diff --git a/go.mod b/go.mod index fe161eb352fa..3c53cea74c78 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/anchore/syft -go 1.18 +go 1.19 require ( github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d From 9a1996ddd88415a4ec87a1bdf28baee83a66e63b Mon Sep 17 00:00:00 2001 From: Alex Goodman Date: Tue, 31 Jan 2023 10:20:32 -0500 Subject: [PATCH 2/3] chore: break out json schema drift check into separate script Signed-off-by: Alex Goodman --- .github/scripts/json-schema-drift-check.sh | 27 ++++++++++++++++++++++ Makefile | 5 +--- 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100755 .github/scripts/json-schema-drift-check.sh diff --git a/.github/scripts/json-schema-drift-check.sh b/.github/scripts/json-schema-drift-check.sh new file mode 100755 index 000000000000..7b7f7dd2f62c --- /dev/null +++ b/.github/scripts/json-schema-drift-check.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -u + +if ! git diff-index --quiet HEAD --; then + git diff-index HEAD -- + git --no-pager diff + echo "there are uncommitted changes, please commit them before running this check" + exit 1 +fi + +success=true + +if ! make generate-json-schema; then + echo "Generating json schema failed" + success=false +fi + +if ! git diff-index --quiet HEAD --; then + git diff-index HEAD -- + git --no-pager diff + echo "JSON schema drift detected!" + success=false +fi + +if ! $success; then + exit 1 +fi diff --git a/Makefile b/Makefile index d17deddf84eb..2fdce6d4b0ce 100644 --- a/Makefile +++ b/Makefile @@ -132,10 +132,7 @@ check-go-mod-tidy: check-json-schema-drift: $(call title,Ensure there is no drift between the JSON schema and the code) - @git diff-index --quiet HEAD -- || (echo "there are uncommitted changes, please commit them before running this check" && false) - @make generate-json-schema || (echo "$(RED)$(BOLD)JSON schema drift detected!$(RESET)" && false) - @git diff-index --quiet HEAD -- || (echo "$(RED)$(BOLD)JSON schema drift detected!$(RESET)" && false) - + @.github/scripts/json-schema-drift-check.sh ## Testing targets ################################# From 81662198df33d02df89237bf56b68acf2d927d86 Mon Sep 17 00:00:00 2001 From: Christopher Phillips Date: Tue, 31 Jan 2023 11:22:49 -0500 Subject: [PATCH 3/3] chore: update git index refresh Signed-off-by: Christopher Phillips --- .github/scripts/go-mod-tidy-check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/go-mod-tidy-check.sh b/.github/scripts/go-mod-tidy-check.sh index 6ba8333e8f89..28f22fcdc43c 100755 --- a/.github/scripts/go-mod-tidy-check.sh +++ b/.github/scripts/go-mod-tidy-check.sh @@ -4,7 +4,7 @@ set -eu ORIGINAL_STATE_DIR=$(mktemp -d "TEMP-original-state-XXXXXXXXX") TIDY_STATE_DIR=$(mktemp -d "TEMP-tidy-state-XXXXXXXXX") -trap "cp ${ORIGINAL_STATE_DIR}/* ./ && rm -fR ${ORIGINAL_STATE_DIR} ${TIDY_STATE_DIR}" EXIT +trap "cp -p ${ORIGINAL_STATE_DIR}/* ./ && git update-index -q --refresh && rm -fR ${ORIGINAL_STATE_DIR} ${TIDY_STATE_DIR}" EXIT # capturing original state of files... cp go.mod go.sum "${ORIGINAL_STATE_DIR}"