mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 06:41:49 +08:00
Drone: Fix releasing of next NPM packages (#27965)
* CI: Upgrade build pipeline tool Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Drone: Don't bump NPM package version as part of script Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * cleaned up release next packages script. * made the comment a bit better. Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
This commit is contained in:
@ -47,7 +47,7 @@ commands:
|
|||||||
- run:
|
- run:
|
||||||
name: "Install Grafana build pipeline tool"
|
name: "Install Grafana build pipeline tool"
|
||||||
command: |
|
command: |
|
||||||
VERSION=0.5.15
|
VERSION=0.5.16
|
||||||
curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v${VERSION}/grabpl
|
curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v${VERSION}/grabpl
|
||||||
chmod +x grabpl
|
chmod +x grabpl
|
||||||
mv grabpl /tmp
|
mv grabpl /tmp
|
||||||
|
10
.drone.yml
10
.drone.yml
@ -16,7 +16,7 @@ steps:
|
|||||||
- name: initialize
|
- name: initialize
|
||||||
image: grafana/build-container:1.2.27
|
image: grafana/build-container:1.2.27
|
||||||
commands:
|
commands:
|
||||||
- curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.15/grabpl
|
- curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.16/grabpl
|
||||||
- chmod +x grabpl
|
- chmod +x grabpl
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- mv grabpl bin
|
- mv grabpl bin
|
||||||
@ -241,7 +241,7 @@ steps:
|
|||||||
image: grafana/ci-wix:0.1.1
|
image: grafana/ci-wix:0.1.1
|
||||||
commands:
|
commands:
|
||||||
- $$ProgressPreference = "SilentlyContinue"
|
- $$ProgressPreference = "SilentlyContinue"
|
||||||
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.15/windows/grabpl.exe -OutFile grabpl.exe
|
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.16/windows/grabpl.exe -OutFile grabpl.exe
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
event:
|
event:
|
||||||
@ -265,7 +265,7 @@ steps:
|
|||||||
- name: initialize
|
- name: initialize
|
||||||
image: grafana/build-container:1.2.27
|
image: grafana/build-container:1.2.27
|
||||||
commands:
|
commands:
|
||||||
- curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.15/grabpl
|
- curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.16/grabpl
|
||||||
- chmod +x grabpl
|
- chmod +x grabpl
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- mv grabpl bin
|
- mv grabpl bin
|
||||||
@ -586,7 +586,7 @@ steps:
|
|||||||
image: grafana/ci-wix:0.1.1
|
image: grafana/ci-wix:0.1.1
|
||||||
commands:
|
commands:
|
||||||
- $$ProgressPreference = "SilentlyContinue"
|
- $$ProgressPreference = "SilentlyContinue"
|
||||||
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.15/windows/grabpl.exe -OutFile grabpl.exe
|
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.16/windows/grabpl.exe -OutFile grabpl.exe
|
||||||
|
|
||||||
- name: build-windows-installer
|
- name: build-windows-installer
|
||||||
image: grafana/ci-wix:0.1.1
|
image: grafana/ci-wix:0.1.1
|
||||||
@ -634,7 +634,7 @@ steps:
|
|||||||
- name: initialize
|
- name: initialize
|
||||||
image: grafana/build-container:1.2.27
|
image: grafana/build-container:1.2.27
|
||||||
commands:
|
commands:
|
||||||
- curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.15/grabpl
|
- curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.16/grabpl
|
||||||
- chmod +x grabpl
|
- chmod +x grabpl
|
||||||
- mkdir -p bin
|
- mkdir -p bin
|
||||||
- mv grabpl bin
|
- mv grabpl bin
|
||||||
|
@ -43,7 +43,7 @@ get_file "https://codeclimate.com/downloads/test-reporter/test-reporter-latest-l
|
|||||||
"b4138199aa755ebfe171b57cc46910b13258ace5fbc4eaa099c42607cd0bff32"
|
"b4138199aa755ebfe171b57cc46910b13258ace5fbc4eaa099c42607cd0bff32"
|
||||||
chmod +x /usr/local/bin/cc-test-reporter
|
chmod +x /usr/local/bin/cc-test-reporter
|
||||||
|
|
||||||
curl -fL -o /usr/local/bin/grabpl "https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.15/grabpl"
|
curl -fL -o /usr/local/bin/grabpl "https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.16/grabpl"
|
||||||
|
|
||||||
apk add --no-cache git
|
apk add --no-cache git
|
||||||
# Install Mage
|
# Install Mage
|
||||||
|
@ -44,7 +44,7 @@ get_file "https://codeclimate.com/downloads/test-reporter/test-reporter-latest-l
|
|||||||
"b4138199aa755ebfe171b57cc46910b13258ace5fbc4eaa099c42607cd0bff32"
|
"b4138199aa755ebfe171b57cc46910b13258ace5fbc4eaa099c42607cd0bff32"
|
||||||
chmod 755 /usr/local/bin/cc-test-reporter
|
chmod 755 /usr/local/bin/cc-test-reporter
|
||||||
|
|
||||||
wget -O /usr/local/bin/grabpl "https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.15/grabpl"
|
wget -O /usr/local/bin/grabpl "https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.16/grabpl"
|
||||||
chmod +x /usr/local/bin/grabpl
|
chmod +x /usr/local/bin/grabpl
|
||||||
|
|
||||||
# Install Mage
|
# Install Mage
|
||||||
|
@ -27,7 +27,7 @@ get_file "https://codeclimate.com/downloads/test-reporter/test-reporter-latest-l
|
|||||||
"b4138199aa755ebfe171b57cc46910b13258ace5fbc4eaa099c42607cd0bff32"
|
"b4138199aa755ebfe171b57cc46910b13258ace5fbc4eaa099c42607cd0bff32"
|
||||||
chmod +x /usr/local/bin/cc-test-reporter
|
chmod +x /usr/local/bin/cc-test-reporter
|
||||||
|
|
||||||
wget -O /usr/local/bin/grabpl "https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.15/grabpl"
|
wget -O /usr/local/bin/grabpl "https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.16/grabpl"
|
||||||
chmod +x /usr/local/bin/grabpl
|
chmod +x /usr/local/bin/grabpl
|
||||||
|
|
||||||
# Install Mage
|
# Install Mage
|
||||||
|
@ -6,17 +6,6 @@ PACKAGES=(ui toolkit data runtime e2e e2e-selectors)
|
|||||||
# shellcheck source=./scripts/helpers/exit-if-fail.sh
|
# shellcheck source=./scripts/helpers/exit-if-fail.sh
|
||||||
source "$(dirname "$0")/helpers/exit-if-fail.sh"
|
source "$(dirname "$0")/helpers/exit-if-fail.sh"
|
||||||
|
|
||||||
function parse_git_hash() {
|
|
||||||
git rev-parse --short HEAD 2> /dev/null | sed "s/\(.*\)/\1/"
|
|
||||||
}
|
|
||||||
|
|
||||||
function prepare_version_commit () {
|
|
||||||
echo $'\nCommitting version changes. This commit will not be checked-in!'
|
|
||||||
git config --global user.email "drone@grafana.com"
|
|
||||||
git config --global user.name "Drone"
|
|
||||||
git commit -am "Version commit"
|
|
||||||
}
|
|
||||||
|
|
||||||
function unpublish_previous_canary () {
|
function unpublish_previous_canary () {
|
||||||
_package=$1
|
_package=$1
|
||||||
echo $'\nUnpublishing previous canary packages'
|
echo $'\nUnpublishing previous canary packages'
|
||||||
@ -38,14 +27,6 @@ function unpublish_previous_canary () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get current version from lerna.json
|
|
||||||
PACKAGE_VERSION=$(grep '"version"' lerna.json | cut -d '"' -f 4)
|
|
||||||
# Get current commit's short hash
|
|
||||||
GIT_SHA=$(parse_git_hash)
|
|
||||||
|
|
||||||
echo "Commit: ${GIT_SHA}"
|
|
||||||
echo "Current lerna.json version: ${PACKAGE_VERSION}"
|
|
||||||
|
|
||||||
# check if there were any changes to packages between current and previous commit
|
# check if there were any changes to packages between current and previous commit
|
||||||
count=$(git diff HEAD~1..HEAD --name-only -- packages | awk '{c++} END {print c}')
|
count=$(git diff HEAD~1..HEAD --name-only -- packages | awk '{c++} END {print c}')
|
||||||
count="1"
|
count="1"
|
||||||
@ -53,14 +34,12 @@ if [ -z "$count" ]; then
|
|||||||
echo "No changes in packages, skipping packages publishing"
|
echo "No changes in packages, skipping packages publishing"
|
||||||
else
|
else
|
||||||
echo "Changes detected in ${count} packages"
|
echo "Changes detected in ${count} packages"
|
||||||
echo "Releasing packages under ${PACKAGE_VERSION}-${GIT_SHA}"
|
echo "Starting to release latest canary version"
|
||||||
./node_modules/.bin/lerna version "${PACKAGE_VERSION}-${GIT_SHA}" --exact --no-git-tag-version --no-push --force-publish -y
|
|
||||||
echo $'\nGit status:'
|
|
||||||
git status -s
|
|
||||||
|
|
||||||
prepare_version_commit
|
# Frontend packages have already been versioned and built by the
|
||||||
|
# build-frontend step in drone. We will only unpublish the previous
|
||||||
echo $'\nBuilding packages'
|
# canary version and publish the current built version as the new
|
||||||
|
# latest canary build.
|
||||||
|
|
||||||
for PACKAGE in "${PACKAGES[@]}"
|
for PACKAGE in "${PACKAGES[@]}"
|
||||||
do
|
do
|
||||||
|
@ -3,7 +3,7 @@ publish_image = 'grafana/grafana-ci-deploy:1.2.6'
|
|||||||
grafana_docker_image = 'grafana/drone-grafana-docker:0.3.2'
|
grafana_docker_image = 'grafana/drone-grafana-docker:0.3.2'
|
||||||
alpine_image = 'alpine:3.12'
|
alpine_image = 'alpine:3.12'
|
||||||
windows_image = 'mcr.microsoft.com/windows:1809'
|
windows_image = 'mcr.microsoft.com/windows:1809'
|
||||||
grabpl_version = '0.5.15'
|
grabpl_version = '0.5.16'
|
||||||
git_image = 'alpine/git:v2.26.2'
|
git_image = 'alpine/git:v2.26.2'
|
||||||
dockerize_version = '0.6.1'
|
dockerize_version = '0.6.1'
|
||||||
wix_image = 'grafana/ci-wix:0.1.1'
|
wix_image = 'grafana/ci-wix:0.1.1'
|
||||||
|
Reference in New Issue
Block a user