diff --git a/.binny.yaml b/.binny.yaml index 020c72611..9c42f2b25 100644 --- a/.binny.yaml +++ b/.binny.yaml @@ -2,7 +2,7 @@ tools: # we want to use a pinned version of binny to manage the toolchain (so binny manages itself!) - name: binny version: - want: v0.7.0 + want: v0.8.0 method: github-release with: repo: anchore/binny @@ -18,7 +18,7 @@ tools: # used to sign mac binaries at release - name: quill version: - want: v0.4.1 + want: v0.4.2 method: github-release with: repo: anchore/quill @@ -26,7 +26,7 @@ tools: # used for linting - name: golangci-lint version: - want: v1.59.0 + want: v1.61.0 method: github-release with: repo: golangci/golangci-lint @@ -34,7 +34,7 @@ tools: # used for showing the changelog at release - name: glow version: - want: v1.5.1 + want: v2.0.0 method: github-release with: repo: charmbracelet/glow @@ -42,7 +42,7 @@ tools: # used for signing the checksums file at release - name: cosign version: - want: v2.2.4 + want: v2.4.1 method: github-release with: repo: sigstore/cosign @@ -58,7 +58,7 @@ tools: # used to release all artifacts - name: goreleaser version: - want: v1.26.2 + want: v2.3.2 method: github-release with: repo: goreleaser/goreleaser @@ -103,7 +103,7 @@ tools: # used for running all local and CI tasks - name: task version: - want: v3.37.2 + want: v3.39.2 method: github-release with: repo: go-task/task @@ -111,7 +111,23 @@ tools: # used for triggering a release - name: gh version: - want: v2.49.2 + want: v2.59.0 method: github-release with: repo: cli/cli + + # used to upload test fixture cache + - name: oras + version: + want: v1.2.0 + method: github-release + with: + repo: oras-project/oras + + # used to upload test fixture cache + - name: yq + version: + want: v4.44.3 + method: github-release + with: + repo: mikefarah/yq diff --git a/.bouncer.yaml b/.bouncer.yaml index b27baa6ea..5360418ef 100644 --- a/.bouncer.yaml +++ b/.bouncer.yaml @@ -6,6 +6,7 @@ permit: - MPL.* - ISC - WTFPL + - Unlicense ignore-packages: # packageurl-go is released under the MIT license located in the root of the repo at /mit.LICENSE diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 0a100afe4..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: bug -assignees: '' - ---- - -**What happened**: - -**What you expected to happen**: - -**Steps to reproduce the issue**: - -**Anything else we need to know?**: - -**Environment**: -- Output of `syft version`: -- OS (e.g: `cat /etc/os-release` or similar): diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index edd71d504..000000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,6 +0,0 @@ -contact_links: - - - name: Join the Slack community šŸ’¬ - # link to our community Slack registration page - url: https://anchore.com/slack - about: 'Come chat with us! Ask for help, join our software development efforts, or just give us feedback!' diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index d07c5f151..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: enhancement -assignees: '' - ---- - -**What would you like to be added**: - -**Why is this needed**: - -**Additional context**: - diff --git a/.github/actions/bootstrap/action.yaml b/.github/actions/bootstrap/action.yaml deleted file mode 100644 index d0a5ee678..000000000 --- a/.github/actions/bootstrap/action.yaml +++ /dev/null @@ -1,61 +0,0 @@ -name: "Bootstrap" - -description: "Bootstrap all tools and dependencies" -inputs: - go-version: - description: "Go version to install" - required: true - default: "1.21.x" - go-dependencies: - description: "Download go dependencies" - required: true - default: "true" - cache-key-prefix: - description: "Prefix all cache keys with this value" - required: true - default: "1ac8281053" - compute-fingerprints: - description: "Compute test fixture fingerprints" - required: true - default: "true" - bootstrap-apt-packages: - description: "Space delimited list of tools to install via apt" - default: "libxml2-utils" - - -runs: - using: "composite" - steps: - # note: go mod and build is automatically cached on default with v4+ - - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 #v5.0.1 - if: inputs.go-version != '' - with: - go-version: ${{ inputs.go-version }} - - - name: Restore tool cache - id: tool-cache - uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2 - with: - path: ${{ github.workspace }}/.tool - key: ${{ inputs.cache-key-prefix }}-${{ runner.os }}-tool-${{ hashFiles('.binny.yaml') }} - - - name: Install project tools - shell: bash - run: make tools - - - name: Install go dependencies - if: inputs.go-dependencies == 'true' - shell: bash - run: make ci-bootstrap-go - - - name: Install apt packages - if: inputs.bootstrap-apt-packages != '' - shell: bash - run: | - DEBIAN_FRONTEND=noninteractive sudo apt update && sudo -E apt install -y ${{ inputs.bootstrap-apt-packages }} - - - name: Create all cache fingerprints - if: inputs.compute-fingerprints == 'true' - shell: bash - run: make fingerprints - diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index bcdb6f8f3..000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,19 +0,0 @@ -version: 2 - -updates: - - - package-ecosystem: gomod - directory: "/" - schedule: - interval: "daily" - open-pull-requests-limit: 10 - labels: - - "dependencies" - - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "daily" - open-pull-requests-limit: 10 - labels: - - "dependencies" diff --git a/.github/scripts/check_binary_fixture_size.sh b/.github/scripts/check_binary_fixture_size.sh deleted file mode 100755 index 764824820..000000000 --- a/.github/scripts/check_binary_fixture_size.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -# current limit for fixture size -size=1000 - -if [ $# -eq 0 ]; then - echo "Usage: $0 " - exit 1 -fi - -directory="$1" - -# Remove trailing slash using parameter expansion -directory="${directory%/}" - -if [ ! -d "$directory" ]; then - echo "Directory not found: $directory" - exit 1 -fi - -found_large_files=0 -while IFS= read -r -d '' file; do - if [ $(wc -c < "$file") -gt $size ]; then - echo "File $file is greater than ${size} bytes." - found_large_files=1 - fi -done < <(find "$directory" -type f -print0) - -if [ "$found_large_files" -eq 1 ]; then - echo "Script failed: Some files are greater than ${size} bytes." - exit 1 -else - echo "All files in $directory and its subdirectories are ${size} bytes or smaller. Check passed." - exit 0 -fi - diff --git a/.github/scripts/ci-check.sh b/.github/scripts/ci-check.sh deleted file mode 100755 index 0ab83a318..000000000 --- a/.github/scripts/ci-check.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -red=$(tput setaf 1) -bold=$(tput bold) -normal=$(tput sgr0) - -# assert we are running in CI (or die!) -if [[ -z "$CI" ]]; then - echo "${bold}${red}This step should ONLY be run in CI. Exiting...${normal}" - exit 1 -fi diff --git a/.github/scripts/coverage.py b/.github/scripts/coverage.py deleted file mode 100755 index db14135cd..000000000 --- a/.github/scripts/coverage.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python3 -import subprocess -import sys -import shlex - - -class bcolors: - HEADER = '\033[95m' - OKBLUE = '\033[94m' - OKCYAN = '\033[96m' - OKGREEN = '\033[92m' - WARNING = '\033[93m' - FAIL = '\033[91m' - ENDC = '\033[0m' - BOLD = '\033[1m' - UNDERLINE = '\033[4m' - - -if len(sys.argv) < 3: - print("Usage: coverage.py [threshold] [go-coverage-report]") - sys.exit(1) - - -threshold = float(sys.argv[1]) -report = sys.argv[2] - - -args = shlex.split(f"go tool cover -func {report}") -p = subprocess.run(args, capture_output=True, text=True) - -percent_coverage = float(p.stdout.splitlines()[-1].split()[-1].replace("%", "")) -print(f"{bcolors.BOLD}Coverage: {percent_coverage}%{bcolors.ENDC}") - -if percent_coverage < threshold: - print(f"{bcolors.BOLD}{bcolors.FAIL}Coverage below threshold of {threshold}%{bcolors.ENDC}") - sys.exit(1) diff --git a/.github/scripts/go-mod-tidy-check.sh b/.github/scripts/go-mod-tidy-check.sh deleted file mode 100755 index 28f22fcdc..000000000 --- a/.github/scripts/go-mod-tidy-check.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash -set -eu - -ORIGINAL_STATE_DIR=$(mktemp -d "TEMP-original-state-XXXXXXXXX") -TIDY_STATE_DIR=$(mktemp -d "TEMP-tidy-state-XXXXXXXXX") - -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}" - -# capturing state of go.mod and go.sum after running go mod tidy... -go mod tidy -cp go.mod go.sum "${TIDY_STATE_DIR}" - -set +e - -# detect difference between the git HEAD state and the go mod tidy state -DIFF_MOD=$(diff -u "${ORIGINAL_STATE_DIR}/go.mod" "${TIDY_STATE_DIR}/go.mod") -DIFF_SUM=$(diff -u "${ORIGINAL_STATE_DIR}/go.sum" "${TIDY_STATE_DIR}/go.sum") - -if [[ -n "${DIFF_MOD}" || -n "${DIFF_SUM}" ]]; then - echo "go.mod diff:" - echo "${DIFF_MOD}" - echo "go.sum diff:" - echo "${DIFF_SUM}" - echo "" - printf "FAILED! go.mod and/or go.sum are NOT tidy; please run 'go mod tidy'.\n\n" - exit 1 -fi diff --git a/.github/scripts/json-schema-drift-check.sh b/.github/scripts/json-schema-drift-check.sh deleted file mode 100755 index 3002236d6..000000000 --- a/.github/scripts/json-schema-drift-check.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -set -u - -if [ "$(git status --porcelain | wc -l)" -ne "0" ]; then - echo " šŸ”“ there are uncommitted changes, please commit them before running this check" - exit 1 -fi - -if ! make generate-json-schema; then - echo "Generating json schema failed" - exit 1 -fi - -if [ "$(git status --porcelain | wc -l)" -ne "0" ]; then - echo " šŸ”“ there are uncommitted changes, please commit them before running this check" - exit 1 -fi diff --git a/.github/scripts/labeler.py b/.github/scripts/labeler.py deleted file mode 100644 index b33dd6df0..000000000 --- a/.github/scripts/labeler.py +++ /dev/null @@ -1,247 +0,0 @@ -from __future__ import annotations - -import sys -import glob -import subprocess -import os -import re - -DRY_RUN = False - -JSON_SCHEMA_LABEL = "json-schema" - -# note: we can't use "breaking-change" as the label since that might be applied manually by a user. This is a -# distinct label that we can use to indicate that the label was applied (or removed) by automation. -BREAKING_CHANGE_LABEL = "detected-breaking-change" - - -def main(changed_files: str | None = None, merge_base_schema_files: str | None = None): - global DRY_RUN - - pr_number = os.environ.get("GITHUB_PR_NUMBER") - comment_file_path = os.environ.get("CI_COMMENT_FILE") - - if not comment_file_path: - print("CI_COMMENT_FILE not set") - sys.exit(1) - - if not pr_number: - DRY_RUN = True - - if changed_files: - DRY_RUN = True - - # read lines from file... this is useful for local testing - with open(changed_files) as f: - pr_changed_files = f.read().splitlines() - - with open(merge_base_schema_files) as f: - og_json_schema_files = sort_json_schema_files(f.read().splitlines()) - - else: - if not is_ci(): - print("Not in CI") - sys.exit(1) - - if not pr_number: - print("Not a PR") - sys.exit(1) - - pr_changed_files = get_pr_changed_files(pr_number) - # since we are running this in the context of the pull_request_target, the checkout is the merge base.. - # that is the main branch of the original repo, NOT the branch in the forked repo (or branch in the target - # repo for non-forked PRs). This means we just need to list the current checkedout files to get a sense of - # the changes before a merge. - og_json_schema_files = list_json_schema_files() - - pr_json_schema_files = filter_to_schema_files(pr_changed_files) - - pr_labels = get_pr_labels(pr_number) - - # print("schema files in pr: ", summarize_schema_files(pr_json_schema_files)) - # print("og schema files: ", summarize_schema_files(og_json_schema_files)) - - if not og_json_schema_files: - print("No schema files found in merge base") - sys.exit(1) - - # pr_json_schema_files = set of PR files are added, removed, and changed files - new_schema_files = set(pr_json_schema_files) - set(og_json_schema_files) - removed_or_modified_schema_files = set(pr_json_schema_files) - set(new_schema_files) - - print("new schemas: ", summarize_schema_files(new_schema_files)) - print("removed or modified schemas:", summarize_schema_files(removed_or_modified_schema_files)) - - # if there is a new or modified schema, we should add the "json-schema" label to the PR... - if new_schema_files or removed_or_modified_schema_files: - print("\nAdding json-schema label...") - add_label(pr_number, JSON_SCHEMA_LABEL) - - else: - if JSON_SCHEMA_LABEL in pr_labels: - remove_label(pr_number, JSON_SCHEMA_LABEL) - - # new schema files should be scrutinized, comparing the latest and added versions to see if it's a breaking - # change (major version bump). Warn about it on the PR via adding a breaking-change label... - if is_breaking_change(new_schema_files, og_json_schema_files[-1]): - print("\nBreaking change detected...") - add_label(pr_number, BREAKING_CHANGE_LABEL) - else: - if BREAKING_CHANGE_LABEL in pr_labels: - remove_label(pr_number, BREAKING_CHANGE_LABEL) - - # modifying an existing schema could be a breaking change, we should warn about it on the PR via a comment... - # removing schema files should never be allowed, we should warn about it on the PR via a comment... - if removed_or_modified_schema_files: - print("\nRemoved or modified schema detected...") - schemas = sort_json_schema_files(list(removed_or_modified_schema_files)) - schemas_str = "\n".join([f" - {schema}" for schema in schemas]) - add_comment(comment_file_path, f"Detected modification or removal of existing json schemas:\n{schemas_str}", warning=True) - - -def add_comment(comment_file_path: str, comment: str, warning: bool = False, important: bool = False): - if warning or important: - comment_lines = comment.splitlines() - comment = "\n".join([f"> {line}" for line in comment_lines]) - - if warning: - comment = f"> [!WARNING]\n{comment}" - elif important: - comment = f"> [!IMPORTANT]\n{comment}" - - # create any parent directories if they don't exist - os.makedirs(os.path.dirname(comment_file_path), exist_ok=True) - - with open(comment_file_path, "w") as f: - f.write(comment) - - print(f"Comment file contents: {comment_file_path}") - print(comment) - - -def add_label(pr_number: str, label: str): - # run "gh pr edit --add-label