-
Notifications
You must be signed in to change notification settings - Fork 5
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
Changed to execute a scan job when the build job is finished. #340
Conversation
.github/workflows/release.yaml
Outdated
scan: | ||
name: Scan images | ||
runs-on: ubuntu-24.04 | ||
needs: build | ||
steps: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By splitting a job, we can't refer BUILD
file generated at build
job at scan
job.
You can use GITHUB_OUTPUT
variable to pass key-value pairs across jobs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned at other place, we need to consider how to use GITHUB_OUTPUT
.github/workflows/release.yaml
Outdated
YAMORY_IMAGE_IDENTIFIER="${d}:$BRANCH" YAMORY_IMAGE_NAME="${d}:$TAG" bash -c "$(curl -sSf -L https://mw-receiver.yamory.io/image/script/trivy)" | ||
done | ||
for ubuntu_version in ${{ env.ubuntu-version }}; do | ||
cd $ubuntu_version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Q]
Does this work?
It may fail from second loop because the second time it run the cd
command from ${WORK_DIR}/20.04
to ${WORK_DIR}/20.04/22.04
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found out that it didn't work when I debugged it on my own, so I fixed the way I wrote it 🙏
.github/workflows/release.yaml
Outdated
@@ -6,8 +6,8 @@ on: | |||
env: | |||
go-version: 1.23 | |||
jobs: | |||
release: | |||
name: release images | |||
build: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks better the job identifier remain "release" since its main purpose is release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@012xx
How about this?
.github/workflows/release.yaml
Outdated
cd ${ubuntu_version} | ||
TAG=$(cat TAG) | ||
for ubuntu_image in ${{ env.ubuntu-image }}; do | ||
echo | ||
echo "scanning $d:$TAG ..." | ||
YAMORY_IMAGE_IDENTIFIER="${d}:$BRANCH" YAMORY_IMAGE_NAME="${d}:$TAG" bash -c "$(curl -sSf -L https://mw-receiver.yamory.io/image/script/trivy)" | ||
echo "scanning ${ubuntu_image}:${TAG} ..." | ||
YAMORY_IMAGE_IDENTIFIER="ghcr.io/cybozu/${ubuntu_image}:${ubuntu_version}" YAMORY_IMAGE_NAME="${ubuntu_image}:${TAG}" bash -c "$(curl -sSf -L https://mw-receiver.yamory.io/image/script/trivy)" | ||
done | ||
cd ../ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned another PR, we don't need to cd
but only specify the paths from parent path.
e.g., TAG=$(cat "${ubuntu_version}/TAG")
…n in release workflow
.github/workflows/release.yaml
Outdated
echo "scanning $d:$TAG ..." | ||
YAMORY_IMAGE_IDENTIFIER="${d}:$BRANCH" YAMORY_IMAGE_NAME="${d}:$TAG" bash -c "$(curl -sSf -L https://mw-receiver.yamory.io/image/script/trivy)" | ||
echo "scanning ${ubuntu_image}:${TAG} ..." | ||
YAMORY_IMAGE_IDENTIFIER="ghcr.io/cybozu/${ubuntu_image}:${ubuntu_version}" YAMORY_IMAGE_NAME="${ubuntu_image}:${TAG}" bash -c "$(curl -sSf -L https://mw-receiver.yamory.io/image/script/trivy)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think YAMORY_IMAGE_NAME
should be modified.
Please check the file before you modified here.
YAMORY_IMAGE_IDENTIFIER="ghcr.io/cybozu/${ubuntu_image}:${ubuntu_version}" YAMORY_IMAGE_NAME="${ubuntu_image}:${TAG}" bash -c "$(curl -sSf -L https://mw-receiver.yamory.io/image/script/trivy)" | |
YAMORY_IMAGE_IDENTIFIER="ghcr.io/cybozu/${ubuntu_image}:${ubuntu_version}" YAMORY_IMAGE_NAME="ghcr.io/cybozu/${ubuntu_image}:${TAG}" bash -c "$(curl -sSf -L https://mw-receiver.yamory.io/image/script/trivy)" |
.github/workflows/release.yaml
Outdated
@@ -6,8 +6,8 @@ on: | |||
env: | |||
go-version: 1.23 | |||
jobs: | |||
release: | |||
name: release images | |||
build: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@012xx
How about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Overview
Why
What
curl -sSf -L https://mw-receiver.yamory.io/image/script/trivyin
in parallel.