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

Fix action on release vulnerabilities #1767

Merged
merged 1 commit into from
Jan 8, 2025
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
4 changes: 2 additions & 2 deletions .github/report-release-vulnerabilities.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ for image in "${images[@]}"; do
done

# check if issue exists, if yes, update description, otherwise create one, or close it if vulnerabilities are gone
assignees="$(dyff json OWNERS | jq -r '.approvers | join(",")')"
issues="$(gh issue list --label release-vulnerabilities --json number)"

if [ "$(jq length <<<"${issues}")" == "0" ]; then
assignees="$(dyff json OWNERS | jq -r '.approvers | join(",")')"

if [ "${hasVulnerabilities}" == "true" ]; then
# create new issue
Expand All @@ -130,7 +130,7 @@ else
# update issue
echo "[INFO] Updating existing issue ${issueNumber}"
gh issue edit "${issueNumber}" \
--assignee "${assignees}" \
--add-assignee "${assignees}" \
--body-file /tmp/report.md
else
gh issue close --reason "No vulnerabilities found in the latest release ${RELEASE_TAG}"
Expand Down
23 changes: 16 additions & 7 deletions .github/workflows/report-release-vulnerabilities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: main
- name: Install Go
uses: actions/setup-go@v5
with:
Expand All @@ -22,12 +24,17 @@ jobs:
run: curl --location --silent "https://github.com/google/go-containerregistry/releases/download/$(curl -s https://api.github.com/repos/google/go-containerregistry/releases/latest | jq -r '.tag_name')/go-containerregistry_$(uname -s)_$(uname -m | sed -e 's/aarch64/arm64/').tar.gz" | sudo tar -xzf - -C /usr/local/bin crane
- name: Install dyff
run: curl --silent --location https://raw.githubusercontent.com/homeport/dyff/main/scripts/download-latest.sh | bash
- name: Install Ko
uses: ko-build/[email protected]
with:
version: v0.17.1
Copy link
Contributor

Choose a reason for hiding this comment

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

Docs: Select ko version to install

By default, ko-build/setup-ko installs the latest released version of ko.

Wouldn't that be nice actually?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, let's do that for all actions in a separate PR.

- name: Install Retry
run: curl --location --silent https://raw.githubusercontent.com/homeport/retry/main/hack/download.sh | bash
- name: Install semver
run: go install gitlab.com/usvc/utils/semver/cmd/semver@latest
- name: Install Trivy
run: make install-trivy
working-directory: ${{ github.workspace }}/main
- name: Update Trivy database
env:
TRIVY_USERNAME: ${{ github.repository_owner }}
Expand All @@ -40,22 +47,24 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: ./.github/download-latest-release.sh
working-directory: ${{ github.workspace }}/main
- name: Checkout release branch
uses: actions/checkout@v4
with:
path: /tmp/release-branch
ref: ${{ steps.download-latest-release.release-branch }}
path: release-branch
ref: ${{ steps.download-latest-release.outputs.release-branch }}
- name: Install Go version of latest release
uses: actions/setup-go@v5
with:
go-version: "${{ steps.download-latest-release.go-version }}.x"
go-version: "${{ steps.download-latest-release.outputs.go-version }}.x"
cache: true
check-latest: true
- name: Report vulnerabilities
env:
GH_TOKEN: ${{ github.token }}
RELEASE_BRANCH: ${{ steps.download-latest-release.release-branch }}
RELEASE_TAG: ${{ steps.download-latest-release.release-tag }}
RELEASE_YAML: ${{ steps.download-latest-release.release-yaml }}
REPOSITORY: /tmp/release-branch
RELEASE_BRANCH: ${{ steps.download-latest-release.outputs.release-branch }}
RELEASE_TAG: ${{ steps.download-latest-release.outputs.release-tag }}
RELEASE_YAML: ${{ steps.download-latest-release.outputs.release-yaml }}
REPOSITORY: ${{ github.workspace }}/release-branch
run: ./.github/report-release-vulnerabilities.sh
working-directory: ${{ github.workspace }}/main
Loading