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

ci: change to use GitHub actions #239

Merged
merged 2 commits into from
May 1, 2024
Merged

Conversation

FrankYang0529
Copy link
Contributor

Which issue(s) this PR fixes:

longhorn/longhorn#8039

What this PR does / why we need it:

Special notes for your reviewer:

Additional documentation or context

-X main.BuildDate=$BUILDDATE
-linkmode external -extldflags -static"
-X main.BuildDate=$BUILDDATE"
[ "$(uname)" != "Darwin" ] && OTHER_LINKFLAGS="-extldflags -static"
Copy link
Member

Choose a reason for hiding this comment

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

nit: This should not happen, as we build only on Linux, except for local development which is done on Mac.

It's better to explain why removing linkmod, as it will be auto by default. We don't need to do it specially.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @innobead, I copied these lines from https://github.com/longhorn/longhorn-manager/blob/4dbba5b1c1036acdbc35f01982b0f15fa00f5dc4/scripts/build#L6-L9.

If we put -linkmode external, the make build can't pass on MacBook.

+ CGO_ENABLED=0
+ GOARCH=amd64
+ go build -o bin/backing-image-manager-amd64 -ldflags '-X main.Version=e99083a-dirty
           -X main.GitCommit=e99083a9ae07f8259456711fc58a06127dea3afd
           -X main.BuildDate=2024-05-02T07:40:08+00:00
           -linkmode external -extldflags -static' -cover -coverpkg=github.com/longhorn/backing-image-manager/...
# github.com/longhorn/backing-image-manager
loadinternal: cannot find runtime/cgo
/usr/local/go/pkg/tool/linux_arm64/link: running gcc failed: exit status 1

If CGO_ENABLED is changed to 1, the error message change.

+ CGO_ENABLED=1
+ GOARCH=amd64
+ go build -o bin/backing-image-manager-amd64 -ldflags '-X main.Version=e99083a-dirty
           -X main.GitCommit=e99083a9ae07f8259456711fc58a06127dea3afd
           -X main.BuildDate=2024-05-02T07:44:32+00:00
           -linkmode external -extldflags -static' -cover -coverpkg=github.com/longhorn/backing-image-manager/...
# runtime/cgo
gcc: error: unrecognized command line option '-m64'

If I remove -linkmode external, the command can pass without error, but I think it's better to follow the style in longhorn-manager, so I add [ "$(uname)" != "Darwin" ] && OTHER_LINKFLAGS="-extldflags -static".

@innobead
Copy link
Member

innobead commented May 1, 2024

@FrankYang0529 let's do longhorn/longhorn#8467 (comment) in another PR.

@innobead innobead merged commit 8df21c2 into longhorn:master May 1, 2024
7 checks passed
@FrankYang0529 FrankYang0529 deleted the LH-8039 branch May 2, 2024 07:02
@FrankYang0529
Copy link
Contributor Author

@mergify backport v1.6.x

Copy link

mergify bot commented Jun 14, 2024

backport v1.6.x

✅ Backports have been created

@FrankYang0529
Copy link
Contributor Author

@mergify backport v1.5.x

Copy link

mergify bot commented Jun 17, 2024

backport v1.5.x

✅ Backports have been created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants