-
Notifications
You must be signed in to change notification settings - Fork 99
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
build: a number of fixes on Makefile and nix-shell #360
Conversation
Ah looks like CI failed because GOPATH is not set or empty. Is this expected? |
I'm also a bit confused with the |
I think that's because HOME env inheritance is removed |
Can you make builds static? See |
The setup go action step sets it to home/runner/go |
Which bit are you talking about? It checkout the PR code and build image for it and then uses it from the built image locally? |
No: https://github.com/openebs/lvm-localpv/actions/runs/12331398437/job/34417991555#step:7:34 Ah I wanted to ask you, why is this needed? In my case it's always there, even without this line. |
7fcd6bb
to
226c3d2
Compare
Fixed by taking go env, PTAL |
Discussed offline, I will update here... |
3bcaf59
to
5a38965
Compare
The problem here is that the dockerfile is simply copying the binary to the container. On non-nix binaries this might work though it might also fail at runtime potentially if the OS libs are not compatible with the container libs. On the other hand the buildx is building inside the docker build, which is a bit better, though it seems that the same problem may arise from what I can tell looking at it? I'll make use of musl-gcc on the nix-shell and make build static just for the nix-shell for now? Or shall we make it static for docker buildx as well? CC @Abhinandan-Purkait @dsharma-dc |
Yes, I think RHEL Based users may face the same problem, NixOS is a big example since it's so different that other distributions in terms of paths, etc. I think we can also change our flow to build directly through the Dockerfile (For example if we are running our runtime in debian we can also use golang debian based image) |
With static builds we could also publish binary builds later on (I know the usage for that is rare, but we can do it too) |
5a38965
to
bc482b4
Compare
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.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
shellcheck
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
lvm-localpv/buildscripts/build.sh
Line 100 in bc482b4
if [ $GOOS = "windows" ]; then |
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
lvm-localpv/buildscripts/build.sh
Line 118 in bc482b4
GOPATH="$(cygpath $GOPATH)" |
Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a. SC2206
lvm-localpv/buildscripts/build.sh
Line 122 in bc482b4
IFS=: MAIN_GOPATH=($GOPATH) |
Expanding an array without an index only gives the first element. SC2128
lvm-localpv/buildscripts/build.sh
Line 126 in bc482b4
mkdir -p ${MAIN_GOPATH}/bin/ |
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
lvm-localpv/buildscripts/build.sh
Line 126 in bc482b4
mkdir -p ${MAIN_GOPATH}/bin/ |
For loops over find output are fragile. Use find -exec or a while read loop. SC2044
lvm-localpv/buildscripts/build.sh
Line 130 in bc482b4
for F in $(find ${DEV_PLATFORM} -mindepth 1 -maxdepth 1 -type f); do |
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
lvm-localpv/buildscripts/build.sh
Line 130 in bc482b4
for F in $(find ${DEV_PLATFORM} -mindepth 1 -maxdepth 1 -type f); do |
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
lvm-localpv/buildscripts/build.sh
Line 131 in bc482b4
cp ${F} bin/${PNAME}/ |
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
lvm-localpv/buildscripts/build.sh
Line 131 in bc482b4
cp ${F} bin/${PNAME}/ |
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
lvm-localpv/buildscripts/build.sh
Line 132 in bc482b4
cp ${F} ${MAIN_GOPATH}/bin/ |
Expanding an array without an index only gives the first element. SC2128
lvm-localpv/buildscripts/build.sh
Line 132 in bc482b4
cp ${F} ${MAIN_GOPATH}/bin/ |
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
lvm-localpv/buildscripts/build.sh
Line 132 in bc482b4
cp ${F} ${MAIN_GOPATH}/bin/ |
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
lvm-localpv/buildscripts/build.sh
Line 138 in bc482b4
ls -hl bin/${PNAME}/ |
A ton of shellcheck warnings were given because I modified the shell file, this is not great to be honest, now it's messed up this PR with a ton of comments. |
If we want to make static for nix as well as docker build, then better do that across all localpv repos if they are also following same? |
Yeah, I think that's a better way in general. If we can do it across all repos. |
a2f4d8c
to
723bdfd
Compare
@Abhinandan-Purkait @dsharma-dc @mhkarimi1383 Ok, it is done, please give this around review |
37f58a3
to
9869a71
Compare
A lot of issues on the existing code but seems they are only warned if the file is modified... Signed-off-by: Tiago Castro <[email protected]>
Pin a few packages version which are not compatible on latest. Perhaps all of them should be pinned! Remove a few uses of sudo which should not be required? Add a few packages missing from nix-shell Allow make clean to work properly Don't bootstrap by default, though this may be discussed further. Setup goenv env variables on github actions workflows Add gitignore for the coverage data Signed-off-by: Tiago Castro <[email protected]>
The non-buildx Dockerfile copies a binary built outside of the docker build, which may be broken if the dependencies are not met. This happens on nix-shell as the deps exist on /nix/store. Get around this by building static binaries in the nix-shell. We now depend on golang-alpine image and install musl-dev as well. Signed-off-by: Tiago Castro <[email protected]>
Ensure the namespace is always set correctly to openebs by default. Set the image pull policy properly (wrong var was used...) Signed-off-by: Tiago Castro <[email protected]>
9869a71
to
63547cc
Compare
gingko lvm_utils creates some loop devices and vgs, which are not cleanup in some cases (eg: test failures). furthermore, even between test cases, leftovers are causing subsequent tests to fails, but that's another matter that needs fixing. also ensure make clean cleans these up Signed-off-by: Tiago Castro <[email protected]>
Adds lvm2 and jq Also ensure sudo works in a pure shell Signed-off-by: Tiago Castro <[email protected]>
63547cc
to
d423456
Compare
I have tested the build locally and it was working fine |
shellHook = '' | ||
export HOME=${builtins.getEnv "HOME"} |
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.
HOME env variable should be inherited explicitly when we are using this in GitHub Actions
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.
If GitHub Actions are working fine we can ignore this :)
What this PR does?:
Ensure the namespace is always set correctly to openebs by default.
Set the image pull policy properly (wrong var was used...)
The non-buildx Dockerfile copies a binary built outside of the docker
build, which may be broken if the dependencies are not met.
This happens on nix-shell as the deps exist on /nix/store.
Get around this by building static binaries in the nix-shell.
Pin a few packages version which are not compatible on latest.
Perhaps all of them should be pinned!
Remove a few uses of sudo which should not be required?
Add a few packages missing from nix-shell
Allow make clean to work properly
Don't bootstrap by default, though this may be discussed further.
Setup goenv env variables on github actions workflows
Add gitignore for the coverage data
Does this PR require any upgrade changes?:
If the changes in this PR are manually verified, list down the scenarios covered::
Any additional information for your reviewer? :
Mention if this PR is part of any design or a continuation of previous PRs
Checklist:
<type>(<scope>): <subject>