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

Add an optional "deps" paramter to the go/build pipeline. #428

Merged
merged 1 commit into from
May 5, 2023
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: 4 additions & 0 deletions docs/PIPELINES-GO.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ you can define the following values:
ldflags:
description:
List of [pattern=]arg to pass to the go compiler with -ldflags

deps:
Copy link
Member

Choose a reason for hiding this comment

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

Maybe update_deps?

description: |
space separated list of go modules to update before building. example: github.com/foo/bar@v1.2.3
```

For the most up to date supported features check the
Expand Down
12 changes: 12 additions & 0 deletions pkg/build/pipelines/go/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ inputs:
Directory where binaries will be installed
default: bin

deps:
description: |
space separated list of go modules to update before building. example: github.com/foo/bar@v1.2.3

pipeline:
- runs: |
TAGS=""
Expand All @@ -60,5 +64,13 @@ pipeline:

DEST_PATH="-o ${{targets.destdir}}/${{inputs.prefix}}/${{inputs.install-dir}}/${{inputs.output}}"
cd "${{inputs.modroot}}"

# Install any specified dependencies
if [ ! "${{inputs.deps}}" == "" ]; then
for dep in ${{inputs.deps}}; do
go get $dep
done
go mod tidy
fi
go build ${DEST_PATH} -tags "${TAGS}" -ldflags "${LDFLAGS}" -trimpath ${{inputs.packages}}