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

Commit

Permalink
add version to config.tar.gz (#1395)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyam8 committed Oct 26, 2023
1 parent 9356e17 commit c8d60d3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ vet:
.PHONY: release
release: clean download ## Create all release artifacts
hack/go-build.sh all
tar -zcvf bin/config.tar.gz -C config .
hack/go-build.sh configs
cd bin && sha256sum -b * >"sha256sums.txt"

.PHONY: dev
Expand Down
17 changes: 15 additions & 2 deletions hack/go-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ PLATFORMS=(
)

getos() {
local IFS=/ && read -ra array <<< "$1" && echo "${array[0]}"
local IFS=/ && read -ra array <<<"$1" && echo "${array[0]}"
}

getarch() {
local IFS=/ && read -ra array <<< "$1" && echo "${array[1]}"
local IFS=/ && read -ra array <<<"$1" && echo "${array[1]}"
}

WHICH="$1"
Expand All @@ -43,6 +43,12 @@ build() {
CGO_ENABLED=0 GOOS="$1" GOARCH="$2" go build -ldflags "${GOLDFLAGS}" -o "$3" "github.com/netdata/go.d.plugin/cmd/godplugin"
}

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

build_all_platforms() {
for PLATFORM in "${PLATFORMS[@]}"; do
GOOS=$(getos "$PLATFORM")
Expand Down Expand Up @@ -73,7 +79,14 @@ build_current_platform() {
build "$GOOS" "$GOARCH" bin/godplugin
}

if [[ "$WHICH" == "configs" ]]; then
echo "Creating config archives for version: $VERSION"
create_config_archives
exit 0
fi

echo "Building binaries for version: $VERSION"

if [[ "$WHICH" == "all" ]]; then
build_all_platforms
elif [[ -n "$WHICH" ]]; then
Expand Down

0 comments on commit c8d60d3

Please sign in to comment.