-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add version-branch commit script (#156)
- Loading branch information
Showing
2 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script runs in Grafana's CI when a commit is made to a 'v[0-9].*' branch. | ||
|
||
dst="${DESTINATION}/${DRONE_BUILD_EVENT}/${DRONE_BRANCH}" | ||
local_dst="file://dist/${DRONE_BUILD_EVENT}" | ||
set -e | ||
|
||
# This command enables qemu emulators for building Docker images for arm64/armv6/armv7/etc on the host. | ||
docker run --privileged --rm tonistiigi/binfmt --install all | ||
|
||
# Build all of the grafana.tar.gz packages. | ||
echo "Building tar.gz packages..." | ||
dagger run --silent go run ./cmd \ | ||
package \ | ||
--yarn-cache=${YARN_CACHE_FOLDER} \ | ||
--distro=linux/amd64 \ | ||
--distro=linux/arm64 \ | ||
--distro=linux/arm/v6 \ | ||
--distro=linux/arm/v7 \ | ||
--distro=windows/amd64 \ | ||
--distro=darwin/amd64 \ | ||
--checksum \ | ||
--build-id=${DRONE_BUILD_NUMBER} \ | ||
--grafana-dir=${GRAFANA_DIR} \ | ||
--github-token=${GITHUB_TOKEN} \ | ||
--go-version=${GO_VERSION} \ | ||
--destination=${local_dst} \ | ||
--gcp-service-account-key-base64=${GCP_KEY_BASE64} > assets.txt | ||
|
||
echo "Done building tar.gz packages..." | ||
cat assets.txt | ||
|
||
# Copy only the linux/amd64 edition npm artifacts into a separate folder | ||
dagger run --silent go run ./cmd npm \ | ||
$(cat assets.txt | grep tar.gz | grep linux | grep amd64 | grep -v sha256 | awk '{print "--package=" $0}') \ | ||
--destination=${local_dst} \ | ||
--gcp-service-account-key-base64=${GCP_KEY_BASE64} > npm.txt | ||
|
||
# Copy only the linux/amd64 edition storybook into a separate folder | ||
dagger run --silent go run ./cmd storybook \ | ||
$(cat assets.txt | grep tar.gz | grep linux | grep amd64 | grep -v sha256 | awk '{print "--package=" $0}') \ | ||
--destination=${local_dst} \ | ||
--gcp-service-account-key-base64=${GCP_KEY_BASE64} > storybook.txt | ||
|
||
# Use the non-windows, non-darwin, non-rpi packages and create deb packages from them. | ||
dagger run --silent go run ./cmd deb \ | ||
$(cat assets.txt | grep tar.gz | grep -v docker | grep -v sha256 | grep -v windows | grep -v darwin | grep -v arm-6 | awk '{print "--package=" $0}') \ | ||
--checksum \ | ||
--destination=${local_dst} \ | ||
--gcp-service-account-key-base64=${GCP_KEY_BASE64} > debs.txt | ||
|
||
# Use the armv7 package to build the `rpi` specific version. | ||
dagger run --silent go run ./cmd deb \ | ||
$(cat assets.txt | grep tar.gz | grep -v docker | grep -v sha256 | grep -v windows | grep -v darwin | grep arm-6 | awk '{print "--package=" $0}') \ | ||
--name=grafana-rpi \ | ||
--checksum \ | ||
--destination=${local_dst} \ | ||
--gcp-service-account-key-base64=${GCP_KEY_BASE64} >> debs.txt | ||
|
||
# Make rpm installers for all the same Linux distros, and sign them because RPM packages are signed. | ||
dagger run --silent go run ./cmd rpm \ | ||
$(cat assets.txt | grep tar.gz | grep -v docker | grep -v sha256 | grep -v windows | grep -v darwin | grep -v arm-6 | awk '{print "--package=" $0}') \ | ||
--checksum \ | ||
--destination=${local_dst} \ | ||
--gcp-service-account-key-base64=${GCP_KEY_BASE64} \ | ||
--sign=true \ | ||
--gpg-private-key-base64="${GPG_PRIVATE_KEY}" \ | ||
--gpg-public-key-base64="${GPG_PUBLIC_KEY}" \ | ||
--gpg-passphrase="${GPG_PASSPHRASE}" > rpms.txt | ||
|
||
# For Windows we distribute zips and exes | ||
dagger run --silent go run ./cmd zip \ | ||
$(cat assets.txt | grep tar.gz | grep -v docker | grep -v sha256 | grep windows | awk '{print "--package=" $0}') \ | ||
--destination=${local_dst} \ | ||
--gcp-service-account-key-base64=${GCP_KEY_BASE64} \ | ||
--checksum > zips.txt | ||
|
||
dagger run --silent go run ./cmd windows-installer \ | ||
$(cat assets.txt | grep tar.gz | grep -v docker | grep -v sha256 | grep windows | awk '{print "--package=" $0}') \ | ||
--destination=${local_dst} \ | ||
--gcp-service-account-key-base64=${GCP_KEY_BASE64} \ | ||
--checksum > exes.txt | ||
|
||
# Build a docker image for all Linux distros except armv6 | ||
dagger run --silent go run ./cmd docker \ | ||
$(cat assets.txt | grep tar.gz | grep -v docker | grep -v sha256 | grep -v windows | grep -v darwin | grep -v arm-6 | awk '{print "--package=" $0}') \ | ||
--checksum \ | ||
--ubuntu-base="ubuntu:22.10" \ | ||
--alpine-base="alpine:3.18.0" \ | ||
--destination=${local_dst} \ | ||
--gcp-service-account-key-base64=${GCP_KEY_BASE64} > docker.txt | ||
|
||
cat debs.txt rpms.txt zips.txt exes.txt docker.txt npm.txt storybook.txt >> assets.txt | ||
|
||
echo "Final list of artifacts:" | ||
cat assets.txt | ||
|
||
# Move the tar.gz packages to their expected locations | ||
cat assets.txt | go run ./scripts/move_packages.go ./dist/prerelease |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters