-
Notifications
You must be signed in to change notification settings - Fork 85
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
feat: Add yq to act and custom #117
Conversation
Since there's a lot of hard-coded references to this path.
Unlike upstream we detect the arch suffix here.
11 minutes of pulling later... can confirm it's the same as: docker run --rm catthehacker/ubuntu:full-latest yq --version
# yq (https://github.com/mikefarah/yq/) version v4.35.2 |
linux/ubuntu/scripts/act.sh
Outdated
case "$(uname -m)" in | ||
'aarch64') | ||
scripts=( | ||
yq | ||
) | ||
;; | ||
'x86_64') | ||
scripts=( | ||
yq | ||
) | ||
;; | ||
*) exit 1 ;; | ||
esac | ||
|
||
for SCRIPT in "${scripts[@]}"; do | ||
printf "\n\t🧨 Executing %s.sh 🧨\t\n" "${SCRIPT}" | ||
"/imagegeneration/installers/${SCRIPT}.sh" | ||
done |
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.
this breaks building on any arch other than aarch64/x86_64
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.
Especially a problem, because the act base image is built for armhf, aarch64 and x86_64.
The flavour images are not built for armhf and usually don't work on any arch other than aarch64 (rust image not built due to cpu intensive compiling in qemu)/x86_64.
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.
Yeah good point, I looked at the wrong matrix. The yq script already supports arm/v7.
I'll have a look at updating the cases.
Does this approach otherwise look OK?
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.
Added the missing arch
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.
Some thoughts from my side...
I would be careful if you remove double quotes in bash, have bad experience in the past.
else | ||
local ERR_EXIT_ENABLED=false | ||
fi | ||
set +e |
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.
Why did you add ERR_EXIT_ENABLED if it is ignored in the first iteration due to unconditional set +e
?
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.
The changes to this script aren't my own. They're from the upstream repository.
Primary reason I found the sync was necessary was because checksum validation code was added and used for the yq
download.
I'll have to defer to the blame upstream for your questions though :]
Here it's actions/runner-images#8352
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.
Just to be clear, I'm not defending the decisions upstream. I don't have an opinion on the suggestions you made here.
But I think there's maintenance tradeoffs between how closely you want to track the other repo. So I feel the decision to diverge and track our own patches here should be up to the maintainers and not me :]
Feel free to edit, or request changes.
@@ -49,21 +57,156 @@ download_with_retries() { | |||
## echo "packageName is not installed!" | |||
## fi | |||
IsPackageInstalled() { | |||
dpkg -S "$1" &>/dev/null | |||
dpkg -S $1 &> /dev/null |
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.
Is this necessary to remove quotes?
Removing quotes in bash is dangerous.
Example:
listargs() { while [[ -n "$1" ]]; do echo $1; shift; done };
IsPackageInstalled() { listargs -S $1; } ;
IsPackageInstalled "hello or";
argument hello or
ends up beeing interpreted by bash.
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.
Seems upstream this was never quoted.
I found this, but is just a move. The code before was initial commit.
actions/runner-images@a7ee8ab
linux/ubuntu/scripts/custom.sh
Outdated
@@ -41,9 +41,10 @@ case "$(uname -m)" in | |||
go | |||
js | |||
dotnet | |||
yq |
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.
Why do you want to install yq twice in the custom image?
act-latest is the base of custom-latest, js-latest, go-latest and so on
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.
Good catch. That's just me being unfamiliar in the codebase 😂
external_hash=$(get_hash_from_remote_file "${base_url}/checksums" "${filename} " "" " " "19") | ||
use_checksum_comparison "/tmp/yq" "${external_hash}" | ||
# Install YQ | ||
sudo install /tmp/yq /usr/bin/yq |
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.
Maybe /usr/local/bin/yq
to avoid conflicts with apt?
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.
Likewise this script I tried to make minimal changes to compared to upstream.
I'm introducing different architectures here compared to upstream, which only support amd64.
It seems to be a deliberate workflow compatibility choice to install it here though.
actions/runner-images#3768
http_code=$(eval $COMMAND) | ||
exit_code=$? | ||
test "$ERR_EXIT_ENABLED" = true && set -e | ||
if [ $http_code -eq 200 ] && [ $exit_code -eq 0 ]; then |
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.
Why did you remove quotes for http_code? We don't control the output of curl, it may be able to inject stuff.
For example exit_code
can only be a number, because that comes from bash itself.
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.
See upstream actions/runner-images#3721
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.
All fine now. I'm not familar with the pre 2023 history of this repository, there was a linter requiring changes from upstream files.
Resolves #78
I gave this a simple test build locally (linux x86_64).