mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 18:30:41 -06:00
d28d495235
* Add Drone configuration
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Add more steps
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Add more steps
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Build front-end before testing it
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Upgrade grafana/build-container
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Add packaging step
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Trigger on push
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Remove some steps
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Enable steps
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Install Dockerize
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Use node image for test-frontend
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Increase number of test workers
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Make plugin installation depend on frontend tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Make integration tests depend on frontend tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Use grafana/build-container also for front-end tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Upgrade dependencies in order to fix front-end tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Depend on es-check
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Dont' depend on tests before building front-end
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Add more steps
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix packaging
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Simplify
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Try to build images
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix e2e tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Remove steps
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Install netcat
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Include golangci-lint with grafana/build-container
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Build storybook and docs website
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix e2e tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Use build image with root user
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Drop CircleCI dependencies
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix e2e tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix e2e under Drone
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Execute e2e server separately
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Use own plugin for building Docker images
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Use Starlark to configure Drone
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Add enterprise steps to pipeline
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Add more enterprise steps to pipeline
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Maintain Yarn cache
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Build enterprise Docker images
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Build Ubuntu Docker images
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Refactor
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Add Postgres integration test
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Add MySQL integration test
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix integration tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Parameterize integration test DB connections
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Categorize integration tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Use grabpl integration-tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Remove unintended change
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Drone: Disable Ubuntu Docker images for PR pipeline
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Regenerate yarn.lock
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Upgrade grabpl
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Restore Yarn cache before installing in grafana-enterprise
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Use separate pipelines for OSS and enterprise
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Let OSS builds depend on tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Restore Go cache before building back-end
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Reduce number of variants built for PRs
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix building of Docker images
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Drone: Simplify logic
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Drone: Use Starlark
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Drone: Fix syntax error
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Convert .drone.star to YAML
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Upgrade AWS Go SDK
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Drone: Fix Go linting
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Undo irrelevant changes
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Revert "Undo irrelevant changes"
This reverts commit 5152f65972
.
* Undo irrelevant changes
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* e2e: Support Circle
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Remove unused script
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* TypeScript fixes
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* TypeScript fixes
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Remove unused script
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* More Drone support
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Remove unused script
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix build on Circle
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Remove TODO comment
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
90 lines
3.0 KiB
Bash
Executable File
90 lines
3.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eo pipefail
|
|
|
|
PACKAGES=(ui toolkit data runtime e2e e2e-selectors)
|
|
|
|
# shellcheck source=./scripts/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 "circleci@grafana.com"
|
|
git config --global user.name "CirceCI"
|
|
git commit -am "Version commit"
|
|
}
|
|
|
|
function unpublish_previous_canary () {
|
|
_package=$1
|
|
echo $'\nUnpublishing previous canary packages'
|
|
# dist-tag next to be changed to canary when https://github.com/grafana/grafana/pull/18195 is merged
|
|
CURRENT_CANARY=$(npm view @grafana/"${_package}" dist-tags.canary)
|
|
if [ -z "${CURRENT_CANARY}" ]; then
|
|
echo "@grafana/${_package} - Nothing to unpublish"
|
|
else
|
|
echo "Unpublish @grafana/${_package}@${CURRENT_CANARY}"
|
|
_response=$(npm unpublish @grafana/"${_package}"@"${CURRENT_CANARY}" 2>&1) || (
|
|
echo "$_response" | grep "404" || (
|
|
# We want to deprecate here, rather than fail and return an non-0 exit code
|
|
echo "Unpublish unsuccessful [$?]. Deprecating @grafana/${_package}@${CURRENT_CANARY}"
|
|
_response=$(npm deprecate @grafana/"${_package}"@"${CURRENT_CANARY}" "this package has been deprecated" 2>&1) || (
|
|
echo "$_response" | grep "404" && return 0
|
|
)
|
|
)
|
|
)
|
|
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
|
|
count=$(git diff HEAD~1..HEAD --name-only -- packages | awk '{c++} END {print c}')
|
|
count="1"
|
|
if [ -z "$count" ]; then
|
|
echo "No changes in packages, skipping packages publishing"
|
|
else
|
|
echo "Changes detected in ${count} packages"
|
|
echo "Releasing packages under ${PACKAGE_VERSION}-${GIT_SHA}"
|
|
npx 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
|
|
|
|
echo $'\nBuilding packages'
|
|
|
|
for PACKAGE in "${PACKAGES[@]}"
|
|
do
|
|
start=$(date +%s%N)
|
|
yarn workspace @grafana/"${PACKAGE}" run build
|
|
runtime=$((($(date +%s%N) - start)/1000000))
|
|
if [ "${DRONE_BRANCH}" == "master" ]; then
|
|
exit_if_fail ./scripts/ci-metrics-publisher.sh "grafana.ci-buildtimes.${DRONE_STEP_NAME}.$PACKAGE=$runtime"
|
|
elif [ "${CIRCLE_BRANCH}" == "master" ]; then
|
|
exit_if_fail ./scripts/ci-metrics-publisher.sh "grafana.ci-buildtimes.${CIRCLE_JOB}.$PACKAGE=$runtime"
|
|
fi
|
|
|
|
exit_status=$?
|
|
if [ $exit_status -eq 0 ]; then
|
|
unpublish_previous_canary "$PACKAGE"
|
|
else
|
|
echo "Packages build failed, skipping canary release"
|
|
# TODO: notify on slack/email?
|
|
exit
|
|
fi
|
|
done
|
|
|
|
echo $'\nPublishing packages'
|
|
yarn packages:publishCanary
|
|
fi
|
|
|