Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
Vendor archives (#1434)
Browse files Browse the repository at this point in the history
  • Loading branch information
arkamar authored Dec 8, 2023
1 parent dce5f25 commit 0a2ab74
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ bin/
mocks/springboot2/.gradle/
mocks/tmp/*
!mocks/tmp/.gitkeep
.DS_Store
.DS_Store
/vendor
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ build: clean ## Build package

.PHONY: clean
clean:
rm -rf bin
rm -rf bin vendor

.PHONY: check
check: fmt vet ## Run static code analysis
Expand All @@ -40,6 +40,7 @@ vet:
release: clean download ## Create all release artifacts
hack/go-build.sh all
hack/go-build.sh configs
hack/go-build.sh vendor
cd bin && sha256sum -b * >"sha256sums.txt"

.PHONY: dev
Expand Down
15 changes: 14 additions & 1 deletion hack/go-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,18 @@ build() {
}

create_config_archives() {
[ ! -d bin/ ] && mkdir bin
mkdir -p bin
tar -zcvf "bin/config.tar.gz" -C config .
tar -zcvf "bin/go.d.plugin-config-${VERSION}.tar.gz" -C config .
}

create_vendor_archives() {
mkdir -p bin
go mod vendor
tar -zc --transform "s:^:go.d.plugin-${VERSION#v}/:" -f "bin/vendor.tar.gz" vendor
tar -zc --transform "s:^:go.d.plugin-${VERSION#v}/:" -f "bin/go.d.plugin-vendor-${VERSION}.tar.gz" vendor
}

build_all_platforms() {
for PLATFORM in "${PLATFORMS[@]}"; do
GOOS=$(getos "$PLATFORM")
Expand Down Expand Up @@ -85,6 +92,12 @@ if [[ "$WHICH" == "configs" ]]; then
exit 0
fi

if [[ "$WHICH" == "vendor" ]]; then
echo "Creating vendor archives for version: $VERSION"
create_vendor_archives
exit 0
fi

echo "Building binaries for version: $VERSION"

if [[ "$WHICH" == "all" ]]; then
Expand Down

0 comments on commit 0a2ab74

Please sign in to comment.