mirror of https://github.com/grafana/grafana
Chore: Removed unused grafana-plugin-ci images (#62219)
removed unused grafana-plugin-ci imagespull/62332/head
parent
afd39c18ba
commit
89ef62f163
@ -1,10 +0,0 @@ |
||||
FROM alpine:3.15.6 |
||||
|
||||
USER root |
||||
|
||||
COPY scripts scripts |
||||
COPY install /usr/local |
||||
|
||||
WORKDIR scripts |
||||
|
||||
RUN ./deploy.sh |
@ -1,71 +0,0 @@ |
||||
# Using this docker image |
||||
|
||||
Uploaded to dockerhub as grafana/grafana-plugin-ci:latest-alpine |
||||
|
||||
Based off of `circleci/node:12-browsers` |
||||
|
||||
## User |
||||
|
||||
The user will be `circleci` |
||||
The home directory will be `/home/circleci` |
||||
|
||||
## Node |
||||
|
||||
- node 12 is installed |
||||
- yarn is installed globally |
||||
- npm is installed globally |
||||
|
||||
## Go |
||||
|
||||
- Go is installed in `/usr/local/bin/go` |
||||
- golangci-lint is installed in `/usr/local/bin/golangci-lint` |
||||
- mage is installed in `/home/circleci/go/bin/mage` |
||||
|
||||
All of the above directories are in the path, so there is no need to specify fully qualified paths. |
||||
|
||||
## Grafana |
||||
|
||||
- Installed in `/home/circleci/src/grafana` |
||||
- `yarn install` has been run |
||||
|
||||
## Integration/Release Testing |
||||
|
||||
There are 4 previous versions pre-downloaded to /usr/local/grafana. These versions are: |
||||
|
||||
1. 6.6.2 |
||||
2. 6.5.3 |
||||
3. 6.4.5 |
||||
4. 6.3.7 |
||||
|
||||
To test, your CircleCI config will need a run section with something similar to the following |
||||
|
||||
``` |
||||
- run: |
||||
name: Setup Grafana (local install) |
||||
command: | |
||||
sudo dpkg -i /usr/local/grafana/deb/grafana_6.6.2_amd64.deb |
||||
sudo cp ci/grafana-test-env/custom.ini /usr/share/grafana/conf/custom.ini |
||||
sudo cp ci/grafana-test-env/custom.ini /etc/grafana/grafana.ini |
||||
sudo service grafana-server start |
||||
grafana-cli --version |
||||
``` |
||||
|
||||
# Building |
||||
|
||||
To build, cd to `<srcroot>/packages/grafana-toolkit/docker/grafana-plugin-ci-alpine` |
||||
|
||||
``` |
||||
./build.sh |
||||
``` |
||||
|
||||
# Developing/Testing |
||||
|
||||
To test, you should have docker-compose installed. |
||||
|
||||
``` |
||||
cd test |
||||
./start.sh |
||||
``` |
||||
|
||||
You will be in /home/circleci/test with the buildscripts installed to the local directory. |
||||
Do your edits/run tests. When saving, your edits will be available in the container immediately. |
@ -1,22 +0,0 @@ |
||||
#!/bin/bash |
||||
set -eo pipefail |
||||
|
||||
source ./common.sh |
||||
|
||||
# |
||||
# No longer required, but useful to keep just in case we want to deploy |
||||
# changes in toolkit directly to the docker image |
||||
# |
||||
if [ -n "$INCLUDE_TOOLKIT" ]; then |
||||
/bin/rm -rfv install/grafana-toolkit |
||||
mkdir -pv install/grafana-toolkit |
||||
cp -rv ../../bin install/grafana-toolkit |
||||
cp -rv ../../src install/grafana-toolkit |
||||
cp -v ../../package.json install/grafana-toolkit |
||||
cp -v ../../tsconfig.json install/grafana-toolkit |
||||
fi |
||||
|
||||
docker build -t ${DOCKER_IMAGE_NAME} . |
||||
docker push $DOCKER_IMAGE_NAME |
||||
|
||||
[ -n "$INCLUDE_TOOLKIT" ] && /bin/rm -rfv install/grafana-toolkit |
@ -1,8 +0,0 @@ |
||||
#!/bin/bash |
||||
|
||||
## |
||||
## Common variable declarations |
||||
## Find the latest tags on https://hub.docker.com/r/grafana/grafana-plugin-ci/tags?page=1&name=alpine |
||||
## |
||||
|
||||
DOCKER_IMAGE_NAME="grafana/grafana-plugin-ci:1.6.1-alpine" |
@ -1,7 +0,0 @@ |
||||
#!/bin/sh |
||||
|
||||
if [ "$1" == "-rn" ]; then |
||||
false | busybox cp -i -r "$2" "$3" 2>/dev/null |
||||
else |
||||
busybox cp $* |
||||
fi |
@ -1,73 +0,0 @@ |
||||
#!/bin/sh |
||||
## |
||||
# gget |
||||
# A script to get and install grafana versions |
||||
# for usage information see "show_help" below. |
||||
# |
||||
|
||||
latest=$(wget -O - 'https://raw.githubusercontent.com/grafana/grafana/main/latest.json' | jq -r '.stable') |
||||
canary=$(wget -O - "https://grafana.com/api/grafana/versions" | jq ".items[0].version" | tr -d '"') |
||||
|
||||
show_help() { |
||||
echo "Usage: gget <version>" |
||||
echo "" |
||||
echo "where <version> can be:" |
||||
echo " 1) A version from https://grafana.com/grafana/download (ex x.y.z)" |
||||
echo " 2) latest (currently $latest)" |
||||
echo " 3) canary (currently $canary)" |
||||
echo "" |
||||
echo " -h, --help: Display this help message" |
||||
echo "" |
||||
exit 0 |
||||
} |
||||
|
||||
opts=$(getopt -o h --long help -n 'gget' -- "$@") |
||||
[ $? -eq 0 ] || { |
||||
show_help |
||||
} |
||||
|
||||
eval set -- "$opts" |
||||
while true; do |
||||
case "$1" in |
||||
-h | --help) |
||||
show_help |
||||
;; |
||||
--) |
||||
shift |
||||
break |
||||
;; |
||||
*) |
||||
break |
||||
;; |
||||
esac |
||||
shift |
||||
done |
||||
|
||||
[ -z "$1" ] && show_help |
||||
|
||||
# Make sure the script is being run as root |
||||
if [ $EUID -ne 0 ]; then |
||||
echo "This script must be run as root" |
||||
exit 1 |
||||
fi |
||||
|
||||
## |
||||
# MAIN |
||||
# |
||||
# Enough setup, let's actually do something |
||||
# |
||||
version=$1 |
||||
if [ "$version" == "latest" ]; then |
||||
version="$latest" |
||||
wget -O - "https://dl.grafana.com/oss/release/grafana-${version}.linux-amd64.tar.gz" | tar -C /opt -zxf - |
||||
elif [ "$version" == "canary" ]; then |
||||
version="$canary" |
||||
wget -O - "https://dl.grafana.com/oss/main/grafana-${version}.linux-amd64.tar.gz" | tar -C /opt -zxf - |
||||
else |
||||
wget -O - "https://dl.grafana.com/oss/release/grafana-${version}.linux-amd64.tar.gz" | tar -C /opt -zxf - |
||||
fi |
||||
|
||||
/bin/rm -rf /opt/grafana > /dev/null 2>&1 || true |
||||
ln -s /opt/grafana-${version} /opt/grafana |
||||
|
||||
# nohup /opt/grafana/bin/grafana-server -config /opt/grafana/conf/defaults.ini -homepath /opt/grafana >/dev/null 2>&1 & |
@ -1,154 +0,0 @@ |
||||
'use strict'; |
||||
Object.defineProperty(exports, '__esModule', { value: true }); |
||||
const fs = require('fs'); |
||||
const path = require('path'); |
||||
const tslib_1 = require('tslib'); |
||||
|
||||
const getPluginId_1 = require('../../config/utils/getPluginId'); |
||||
const pluginValidation_1 = require('../../config/utils/pluginValidation'); |
||||
const env_1 = require('../../plugins/env'); |
||||
// @ts-ignore
|
||||
// import execa = require('execa');
|
||||
const githubClient_1 = tslib_1.__importDefault(require('./githubClient')); |
||||
const resolveContentType = function (extension) { |
||||
if (extension.startsWith('.')) { |
||||
extension = extension.slice(1); |
||||
} |
||||
switch (extension) { |
||||
case 'zip': |
||||
return 'application/zip'; |
||||
case 'json': |
||||
return 'application/json'; |
||||
case 'sha1': |
||||
return 'text/plain'; |
||||
default: |
||||
return 'application/octet-stream'; |
||||
} |
||||
}; |
||||
const GitHubRelease = /** @class */ (function () { |
||||
function GitHubRelease(token, username, repository, releaseNotes, commitHash) { |
||||
this.token = token; |
||||
this.username = username; |
||||
this.repository = repository; |
||||
this.releaseNotes = releaseNotes; |
||||
this.commitHash = commitHash; |
||||
this.git = new githubClient_1.default({ |
||||
required: true, |
||||
repo: repository, |
||||
}); |
||||
} |
||||
GitHubRelease.prototype.publishAssets = function (srcLocation, destUrl) { |
||||
const _this = this; |
||||
// Add the assets. Loop through files in the ci/dist folder and upload each asset.
|
||||
const files = fs.readdirSync(srcLocation); |
||||
return files.map(function (file) { |
||||
return tslib_1.__awaiter(_this, void 0, void 0, function () { |
||||
let fileStat, fileData; |
||||
return tslib_1.__generator(this, function (_a) { |
||||
fileStat = fs.statSync(srcLocation + '/' + file); |
||||
fileData = fs.readFileSync(srcLocation + '/' + file); |
||||
return [ |
||||
2 /*return*/, |
||||
this.git.client.post(destUrl + '?name=' + file, fileData, { |
||||
headers: { |
||||
'Content-Type': resolveContentType(path.extname(file)), |
||||
'Content-Length': fileStat.size, |
||||
}, |
||||
maxContentLength: fileStat.size * 2 * 1024 * 1024, |
||||
}), |
||||
]; |
||||
}); |
||||
}); |
||||
}); |
||||
}; |
||||
GitHubRelease.prototype.release = function () { |
||||
let _a, _b, _c, _d; |
||||
return tslib_1.__awaiter(this, void 0, void 0, function () { |
||||
let ciDir, |
||||
distDir, |
||||
distContentDir, |
||||
pluginJsonFile, |
||||
pluginInfo, |
||||
PUBLISH_DIR, |
||||
commitHash, |
||||
latestRelease, |
||||
reason_1, |
||||
newReleaseResponse, |
||||
publishPromises, |
||||
reason_2; |
||||
return tslib_1.__generator(this, function (_e) { |
||||
switch (_e.label) { |
||||
case 0: |
||||
ciDir = env_1.getCiFolder(); |
||||
distDir = path.resolve(ciDir, 'dist'); |
||||
distContentDir = path.resolve(distDir, getPluginId_1.getPluginId()); |
||||
pluginJsonFile = path.resolve(distContentDir, 'plugin.json'); |
||||
pluginInfo = pluginValidation_1.getPluginJson(pluginJsonFile).info; |
||||
PUBLISH_DIR = path.resolve(env_1.getCiFolder(), 'packages'); |
||||
commitHash = this.commitHash || ((_a = pluginInfo.build) === null || _a === void 0 ? void 0 : _a.hash); |
||||
_e.label = 1; |
||||
case 1: |
||||
_e.trys.push([1, 5, , 6]); |
||||
return [4 /*yield*/, this.git.client.get('releases/tags/v' + pluginInfo.version)]; |
||||
case 2: |
||||
latestRelease = _e.sent(); |
||||
if (!(latestRelease.data.tag_name === 'v' + pluginInfo.version)) { |
||||
return [3 /*break*/, 4]; |
||||
} |
||||
return [4 /*yield*/, this.git.client.delete('releases/' + latestRelease.data.id)]; |
||||
case 3: |
||||
_e.sent(); |
||||
_e.label = 4; |
||||
case 4: |
||||
return [3 /*break*/, 6]; |
||||
case 5: |
||||
reason_1 = _e.sent(); |
||||
if (reason_1.response.status !== 404) { |
||||
// 404 just means no release found. Not an error. Anything else though, re throw the error
|
||||
throw reason_1; |
||||
} |
||||
return [3 /*break*/, 6]; |
||||
case 6: |
||||
_e.trys.push([6, 9, , 10]); |
||||
return [ |
||||
4 /*yield*/, |
||||
this.git.client.post('releases', { |
||||
tag_name: 'v' + pluginInfo.version, |
||||
target_commitish: commitHash, |
||||
name: 'v' + pluginInfo.version, |
||||
body: this.releaseNotes, |
||||
draft: false, |
||||
prerelease: false, |
||||
}), |
||||
]; |
||||
case 7: |
||||
newReleaseResponse = _e.sent(); |
||||
publishPromises = this.publishAssets( |
||||
PUBLISH_DIR, |
||||
'https://uploads.github.com/repos/' + |
||||
this.username + |
||||
'/' + |
||||
this.repository + |
||||
'/releases/' + |
||||
newReleaseResponse.data.id + |
||||
'/assets' |
||||
); |
||||
return [4 /*yield*/, Promise.all(publishPromises)]; |
||||
case 8: |
||||
_e.sent(); |
||||
return [3 /*break*/, 10]; |
||||
case 9: |
||||
reason_2 = _e.sent(); |
||||
console.log(reason_2); |
||||
// Rethrow the error so that we can trigger a non-zero exit code to circle-ci
|
||||
throw reason_2; |
||||
case 10: |
||||
return [2 /*return*/]; |
||||
} |
||||
}); |
||||
}); |
||||
}; |
||||
return GitHubRelease; |
||||
})(); |
||||
exports.GitHubRelease = GitHubRelease; |
||||
//# sourceMappingURL=githubRelease.js.map7027e10521e9
|
@ -1,52 +0,0 @@ |
||||
#!/bin/sh |
||||
|
||||
## |
||||
# Script to deploy a docker image. Must return exit code 0 |
||||
# |
||||
do_exit() { |
||||
message="$1" |
||||
exit_code="$2" |
||||
|
||||
echo "$message" |
||||
exit $exit_code |
||||
} |
||||
|
||||
|
||||
## |
||||
# Get file, get's a file, validates the SHA |
||||
# @param filename |
||||
# @param expected sha value |
||||
# @returns 0 if successful, -1 of checksum validation failed. |
||||
# |
||||
get_file () { |
||||
[ -n "$1" ] && url=$1 || do_exit "url required" 1 |
||||
[ -n "$2" ] && dest=$2 || do_exit "destination required" 2 |
||||
sha=$3 |
||||
file=$(basename $dest) |
||||
|
||||
curl -fL "${url}" -o "$dest" |
||||
if [ -n "$sha" ]; then |
||||
echo "$sha $dest" | sha256sum || do_exit "Checksum validation failed for $file. Exiting" 1 |
||||
fi |
||||
} |
||||
|
||||
untar_file () { |
||||
[ -n "$1" ] && src=$1 || do_exit "src required" 1 |
||||
[ -n "$2" ] && dest=$2 || dest="/usr/local" |
||||
|
||||
tar -C "$dest" -xf "$src" && /bin/rm -rf "$src" |
||||
} |
||||
|
||||
## |
||||
# WIP: Just started this and not finished. |
||||
# The intent it to download a release from a git repo, |
||||
# compile, and install |
||||
get_latest_release () { |
||||
tarsrc=$(curl -sL "https://api.github.com/repos/$1/$2/releases/latest" | jq ".tarball_url" | tr -d '"') |
||||
curl -fL -o /tmp/autoretrieved.tar.gz "$tarsrc" |
||||
origdir=$PWD |
||||
reponame=$(tar zxvf autoretrieved.tar.gz | tail -1 | awk -F / '{print $1}') |
||||
cd "/tmp/$reponame" |
||||
#perform compile |
||||
cd $origdir |
||||
} |
@ -1,3 +0,0 @@ |
||||
#!/bin/sh |
||||
source "./deploy-common.sh" |
||||
|
@ -1,80 +0,0 @@ |
||||
#!/bin/sh |
||||
set -eo pipefail |
||||
|
||||
source "./deploy-common.sh" |
||||
|
||||
# Make libgcc compatible |
||||
mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2 |
||||
|
||||
# Replace cp with something that mocks the one that ci-package needs |
||||
rm /bin/cp |
||||
mv /usr/local/bin/cp /bin/cp |
||||
|
||||
apk add --no-cache curl npm yarn build-base openssh git-lfs perl-utils coreutils python3 |
||||
|
||||
# |
||||
# Only relevant for testing, but cypress does not work with musl/alpine. |
||||
# |
||||
# apk add --no-cache xvfb glib nss nspr gdk-pixbuf "gtk+3.0" pango atk cairo dbus-libs libxcomposite libxrender libxi libxtst libxrandr libxscrnsaver alsa-lib at-spi2-atk at-spi2-core cups-libs gcompat libc6-compat |
||||
|
||||
# Install Go |
||||
filename="go1.19.4.linux-amd64.tar.gz" |
||||
get_file "https://dl.google.com/go/$filename" "/tmp/$filename" "c9c08f783325c4cf840a94333159cc937f05f75d36a8b307951d5bd959cf2ab8" |
||||
untar_file "/tmp/$filename" |
||||
|
||||
# Install golangci-lint |
||||
GOLANGCILINT_VERSION=1.50.0 |
||||
filename="golangci-lint-${GOLANGCILINT_VERSION}-linux-amd64" |
||||
get_file "https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCILINT_VERSION}/$filename.tar.gz" \ |
||||
"/tmp/$filename.tar.gz" \ |
||||
"b4b329efcd913082c87d0e9606711ecb57415b5e6ddf233fde9e76c69d9b4e8b" |
||||
untar_file "/tmp/$filename.tar.gz" |
||||
ln -s /usr/local/${filename}/golangci-lint /usr/local/bin/golangci-lint |
||||
ln -s /usr/local/go/bin/go /usr/local/bin/go |
||||
ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt |
||||
chmod 755 /usr/local/bin/golangci-lint |
||||
|
||||
# Install dependencies |
||||
apk add --no-cache fontconfig zip jq |
||||
|
||||
# Install code climate |
||||
get_file "https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64" \ |
||||
"/usr/local/bin/cc-test-reporter" \ |
||||
"20d1d4e2b399d0287d91e65faeee8ffbef08e3262b0be5eda7def7b3c2799ddd" |
||||
chmod 755 /usr/local/bin/cc-test-reporter |
||||
|
||||
curl -fL -o /usr/local/bin/grabpl "https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.9.27/grabpl" |
||||
|
||||
apk add --no-cache git |
||||
# Install Mage |
||||
mkdir -pv /tmp/mage $HOME/go/bin |
||||
git clone https://github.com/magefile/mage.git /tmp/mage |
||||
cd /tmp/mage && go run bootstrap.go |
||||
mv $HOME/go/bin/mage /usr/local/bin |
||||
|
||||
wget -O - -q https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b /usr/local/bin v2.14.0 |
||||
|
||||
source "/etc/profile" |
||||
sh -l -c "go get -u github.com/mgechev/revive" |
||||
for file in $(ls $HOME/go/bin); do |
||||
mv -v $HOME/go/bin/$file /usr/local/bin/$file |
||||
done |
||||
|
||||
# Install grafana-toolkit deps |
||||
current_dir=$PWD |
||||
cd /usr/local/grafana-toolkit && yarn install && cd $current_dir |
||||
ln -s /usr/local/grafana-toolkit/bin/grafana-toolkit.js /usr/local/bin/grafana-toolkit |
||||
|
||||
GOOGLE_SDK_VERSION=365.0.1 |
||||
GOOGLE_SDK_CHECKSUM=17003cdba67a868c2518ac16efa60dc6175533b7a9fb87304459784308e30fb0 |
||||
|
||||
curl -fLO https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GOOGLE_SDK_VERSION}-linux-x86_64.tar.gz |
||||
echo "${GOOGLE_SDK_CHECKSUM} google-cloud-sdk-${GOOGLE_SDK_VERSION}-linux-x86_64.tar.gz" | sha256sum --check --status |
||||
tar xvzf google-cloud-sdk-${GOOGLE_SDK_VERSION}-linux-x86_64.tar.gz -C /opt |
||||
rm google-cloud-sdk-${GOOGLE_SDK_VERSION}-linux-x86_64.tar.gz |
||||
ln -s /opt/google-cloud-sdk/bin/gsutil /usr/bin/gsutil |
||||
ln -s /opt/google-cloud-sdk/bin/gcloud /usr/bin/gcloud |
||||
|
||||
# Cleanup after yourself |
||||
/bin/rm -rf /tmp/mage |
||||
/bin/rm -rf $HOME/go |
@ -1,18 +0,0 @@ |
||||
version: '3' |
||||
services: |
||||
citest: |
||||
image: "amd64/alpine" |
||||
user: root |
||||
volumes: |
||||
- ../scripts:/home/circleci/scripts |
||||
- ../install:/home/circleci/install |
||||
- ${HOME}/.ssh:/root/.ssh |
||||
- ../../..:/home/circleci/grafana-toolkit |
||||
cibuilt: |
||||
image: "grafana/grafana-plugin-ci:latest-alpine" |
||||
user: root |
||||
volumes: |
||||
- ../scripts:/home/circleci/scripts |
||||
- ../install:/home/circleci/install |
||||
- ${HOME}/.ssh:/root/.ssh |
||||
- ../../..:/home/circleci/grafana-toolkit |
@ -1,14 +0,0 @@ |
||||
#!/bin/bash |
||||
|
||||
function finish { |
||||
echo "Exiting and cleaning up docker image" |
||||
docker-compose down |
||||
} |
||||
trap finish EXIT |
||||
|
||||
# Enter the docker container |
||||
if [ "$1" = "built" ]; then |
||||
docker-compose run cibuilt sh -c "cd /home/circleci; exec sh --login -i" |
||||
else |
||||
docker-compose run citest sh -c "cd /home/circleci; exec sh --login -i" |
||||
fi |
@ -1,9 +0,0 @@ |
||||
FROM debian:buster-slim |
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive |
||||
|
||||
COPY scripts scripts |
||||
COPY install /usr/local |
||||
|
||||
RUN cd scripts && ./deploy.sh |
||||
ENV DEBIAN_FRONTEND=newt |
@ -1,67 +0,0 @@ |
||||
# Using this docker image |
||||
|
||||
## User |
||||
|
||||
The user will be `circleci` |
||||
The home directory will be `/home/circleci` |
||||
|
||||
## Node |
||||
|
||||
- node 14 is installed |
||||
- yarn is installed globally |
||||
- npm is installed globally |
||||
|
||||
## Go |
||||
|
||||
- Go is installed in `/usr/local/bin/go` |
||||
- golangci-lint is installed in `/usr/local/bin/golangci-lint` |
||||
- mage is installed in `/usr/local/bin/mage` |
||||
|
||||
All of the above directories are in the path, so there is no need to specify fully qualified paths. |
||||
|
||||
## Grafana |
||||
|
||||
- Installed in `/home/circleci/src/grafana` |
||||
- `yarn install` has been run |
||||
|
||||
## Integration/Release Testing |
||||
|
||||
There are 4 previous versions pre-downloaded to /usr/local/grafana. These versions are: |
||||
|
||||
1. 6.6.2 |
||||
2. 6.5.3 |
||||
3. 6.4.5 |
||||
4. 6.3.7 |
||||
|
||||
To test, your CircleCI config will need a run section with something similar to the following |
||||
|
||||
``` |
||||
- run: |
||||
name: Setup Grafana (local install) |
||||
command: | |
||||
sudo dpkg -i /usr/local/grafana/deb/grafana_6.6.2_amd64.deb |
||||
sudo cp ci/grafana-test-env/custom.ini /usr/share/grafana/conf/custom.ini |
||||
sudo cp ci/grafana-test-env/custom.ini /etc/grafana/grafana.ini |
||||
sudo service grafana-server start |
||||
grafana-cli --version |
||||
``` |
||||
|
||||
# Building |
||||
|
||||
To build, cd to `<srcroot>/packages/grafana-toolkit/docker/grafana-plugin-ci-e2e` |
||||
|
||||
``` |
||||
./build.sh |
||||
``` |
||||
|
||||
# Developing/Testing |
||||
|
||||
To test, you should have docker-compose installed. |
||||
|
||||
``` |
||||
cd test |
||||
./start.sh |
||||
``` |
||||
|
||||
You will be in /home/circleci/test with the buildscripts installed to the local directory. |
||||
Do your edits/run tests. When saving, your edits will be available in the container immediately. |
@ -1,24 +0,0 @@ |
||||
#!/bin/bash |
||||
set -eo pipefail |
||||
|
||||
source ./common.sh |
||||
|
||||
# |
||||
# No longer required, but useful to keep just in case we want to deploy |
||||
# changes in toolkit directly to the docker image |
||||
# |
||||
if [ -n "$INCLUDE_TOOLKIT" ]; then |
||||
/bin/rm -rfv install/grafana-toolkit |
||||
mkdir -pv install/grafana-toolkit |
||||
cp -rv ../../bin install/grafana-toolkit |
||||
cp -rv ../../src install/grafana-toolkit |
||||
cp -v ../../package.json install/grafana-toolkit |
||||
cp -v ../../tsconfig.json install/grafana-toolkit |
||||
fi |
||||
|
||||
docker build -t ${DOCKER_IMAGE_NAME} . |
||||
docker push $DOCKER_IMAGE_NAME |
||||
docker tag ${DOCKER_IMAGE_NAME} ${DOCKER_IMAGE_BASE_NAME}:latest |
||||
docker push ${DOCKER_IMAGE_BASE_NAME}:latest |
||||
|
||||
[ -n "$INCLUDE_TOOLKIT" ] && /bin/rm -rfv install/grafana-toolkit |
@ -1,10 +0,0 @@ |
||||
#!/bin/bash |
||||
|
||||
## |
||||
## Common variable declarations |
||||
## Find the latest tag on https://hub.docker.com/r/grafana/grafana-plugin-ci-e2e/tags |
||||
## |
||||
|
||||
DOCKER_IMAGE_BASE_NAME="grafana/grafana-plugin-ci-e2e" |
||||
DOCKER_IMAGE_VERSION="1.6.1" |
||||
DOCKER_IMAGE_NAME="${DOCKER_IMAGE_BASE_NAME}:${DOCKER_IMAGE_VERSION}" |
@ -1,73 +0,0 @@ |
||||
#!/bin/bash |
||||
## |
||||
# gget |
||||
# A script to get and install grafana versions |
||||
# for usage information see "show_help" below. |
||||
# |
||||
|
||||
latest=$(wget -O - 'https://raw.githubusercontent.com/grafana/grafana/main/latest.json' | jq -r '.stable') |
||||
canary=$(wget -O - "https://grafana.com/api/grafana-enterprise/versions" | jq ".items[0].version" | tr -d '"') |
||||
|
||||
show_help() { |
||||
echo "Usage: gget <version>" |
||||
echo "" |
||||
echo "where <version> can be:" |
||||
echo " 1) A version from https://grafana.com/grafana/download (ex x.y.z)" |
||||
echo " 2) latest (currently $latest)" |
||||
echo " 3) canary (currently $canary)" |
||||
echo "" |
||||
echo " -h, --help: Display this help message" |
||||
echo "" |
||||
exit 0 |
||||
} |
||||
|
||||
opts=$(getopt -o h --long help -n 'gget' -- "$@") |
||||
[ $? -eq 0 ] || { |
||||
show_help |
||||
} |
||||
|
||||
eval set -- "$opts" |
||||
while true; do |
||||
case "$1" in |
||||
-h | --help) |
||||
show_help |
||||
;; |
||||
--) |
||||
shift |
||||
break |
||||
;; |
||||
*) |
||||
break |
||||
;; |
||||
esac |
||||
shift |
||||
done |
||||
|
||||
[ -z "$1" ] && show_help |
||||
|
||||
# Make sure the script is being run as root |
||||
if [ $EUID -ne 0 ]; then |
||||
echo "This script must be run as root" |
||||
exit 1 |
||||
fi |
||||
|
||||
## |
||||
# MAIN |
||||
# |
||||
# Enough setup, let's actually do something |
||||
# |
||||
version=$1 |
||||
if [ "$version" == "latest" ]; then |
||||
version="$latest" |
||||
wget -O - "https://dl.grafana.com/enterprise/release/grafana-enterprise-${version}.linux-amd64.tar.gz" | tar -C /opt -zxf - |
||||
elif [ "$version" == "canary" ]; then |
||||
version="$canary" |
||||
wget -O - "https://dl.grafana.com/enterprise/main/grafana-enterprise-${version}.linux-amd64.tar.gz" | tar -C /opt -zxf - |
||||
else |
||||
wget -O - "https://dl.grafana.com/enterprise/release/grafana-enterprise-${version}.linux-amd64.tar.gz" | tar -C /opt -zxf - |
||||
fi |
||||
|
||||
/bin/rm -rf /opt/grafana > /dev/null 2>&1 || true |
||||
ln -s /opt/grafana-${version} /opt/grafana |
||||
|
||||
# nohup /opt/grafana/bin/grafana-server -config /opt/grafana/conf/defaults.ini -homepath /opt/grafana >/dev/null 2>&1 & |
@ -1,37 +0,0 @@ |
||||
#!/bin/bash |
||||
|
||||
## |
||||
# Script to deploy a docker image. Must return exit code 0 |
||||
# |
||||
do_exit() { |
||||
message="$1" |
||||
exit_code="$2" |
||||
|
||||
echo "$message" |
||||
exit $exit_code |
||||
} |
||||
|
||||
## |
||||
# Get file, get's a file, validates the SHA |
||||
# @param filename |
||||
# @param expected sha value |
||||
# @returns 0 if successful, -1 of checksum validation failed. |
||||
# |
||||
get_file () { |
||||
[ -n "$1" ] && url=$1 || do_exit "url required" -1 |
||||
[ -n "$2" ] && dest=$2 || do_exit "destination required" -2 |
||||
sha=$3 |
||||
file=$(basename $dest) |
||||
|
||||
wget "$url" -O "$dest" |
||||
if [ -n "$sha" ]; then |
||||
echo "$sha $dest" | sha256sum --check --status || do_exit "Checksum validation failed for $file. Exiting" -1 |
||||
fi |
||||
} |
||||
|
||||
untar_file () { |
||||
[ -n "$1" ] && src=$1 || do_exit "src required" -1 |
||||
[ -n "$2" ] && dest=$2 || dest="/usr/local" |
||||
|
||||
tar -C "$dest" -xf "$src" && /bin/rm -rf "$src" |
||||
} |
@ -1,27 +0,0 @@ |
||||
#!/bin/bash |
||||
source "/etc/profile" |
||||
|
||||
apt-get --allow-insecure-repositories update |
||||
apt-get install --allow-unauthenticated -y \ |
||||
build-essential \ |
||||
wget git sudo adduser \ |
||||
libfontconfig1 \ |
||||
locate \ |
||||
libnss3 libnspr4 \ |
||||
libgdk-pixbuf2.0-0 \ |
||||
libgtk-3-0 \ |
||||
libpangocairo-1.0-0 \ |
||||
libpango-1.0-0 \ |
||||
libatk1.0-0 \ |
||||
libcairo2 \ |
||||
libdbus-1-3 \ |
||||
libxcomposite1 libxrender1 libxcursor1 libxi6 libxtst6 libxrandr2 libxss1 xauth xvfb \ |
||||
libasound2 \ |
||||
libatk-bridge2.0-0 \ |
||||
libatspi2.0-0 \ |
||||
libcups2 \ |
||||
jq net-tools git-lfs unzip pkg-config zip \ |
||||
libaio1 libaio-dev \ |
||||
netcat \ |
||||
libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb |
||||
|
@ -1,3 +0,0 @@ |
||||
#!/bin/bash |
||||
source "./deploy-common.sh" |
||||
|
@ -1,65 +0,0 @@ |
||||
#!/bin/bash |
||||
set -eo pipefail |
||||
|
||||
source "/etc/profile" |
||||
source "./deploy-slim.sh" |
||||
source "./deploy-common.sh" |
||||
|
||||
NODEVER="v16.13.2" |
||||
# Install Node |
||||
wget -O - "https://nodejs.org/dist/${NODEVER}/node-${NODEVER}-linux-x64.tar.xz" | tar Jvxf - -C "/tmp" |
||||
|
||||
# Move node to /usr/local so it's in the path |
||||
pushd /tmp/node-${NODEVER}-linux-x64 |
||||
/bin/rm -f CHANGELOG.md README.md LICENSE |
||||
/bin/cp -r * /usr/local |
||||
popd |
||||
/bin/rm -rf /tmp/node-${NODEVER} |
||||
|
||||
# Resource the profile so we know our path is being honoured |
||||
source "/etc/profile" |
||||
# Install Yarn. Not in the path yet so fully qualified |
||||
npm i -g yarn |
||||
|
||||
# Install Go |
||||
filename="go1.19.4.linux-amd64.tar.gz" |
||||
get_file "https://dl.google.com/go/$filename" "/tmp/$filename" "c9c08f783325c4cf840a94333159cc937f05f75d36a8b307951d5bd959cf2ab8" |
||||
untar_file "/tmp/$filename" |
||||
|
||||
# Install golangci-lint |
||||
GOLANGCILINT_VERSION=1.50.0 |
||||
filename="golangci-lint-${GOLANGCILINT_VERSION}-linux-amd64" |
||||
get_file "https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCILINT_VERSION}/$filename.tar.gz" \ |
||||
"/tmp/$filename.tar.gz" \ |
||||
"b4b329efcd913082c87d0e9606711ecb57415b5e6ddf233fde9e76c69d9b4e8b" |
||||
untar_file "/tmp/$filename.tar.gz" |
||||
ln -s /usr/local/${filename}/golangci-lint /usr/local/bin/golangci-lint |
||||
ln -s /usr/local/go/bin/go /usr/local/bin/go |
||||
ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt |
||||
chmod 755 /usr/local/bin/golangci-lint |
||||
|
||||
# Install code climate |
||||
get_file "https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64" \ |
||||
"/usr/local/bin/cc-test-reporter" \ |
||||
"20d1d4e2b399d0287d91e65faeee8ffbef08e3262b0be5eda7def7b3c2799ddd" |
||||
chmod 755 /usr/local/bin/cc-test-reporter |
||||
|
||||
wget -O /usr/local/bin/grabpl "https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.9.27/grabpl" |
||||
chmod +x /usr/local/bin/grabpl |
||||
|
||||
# Install Mage |
||||
mkdir -pv /tmp/mage $HOME/go/bin |
||||
git clone https://github.com/magefile/mage.git /tmp/mage |
||||
pushd /tmp/mage && go run bootstrap.go && popd |
||||
mv $HOME/go/bin/mage /usr/local/bin |
||||
# Cleanup after yourself |
||||
/bin/rm -rf /tmp/mage |
||||
/bin/rm -rf $HOME/go |
||||
|
||||
# add cypress |
||||
yarn global add cypress |
||||
# verify cypress install |
||||
cypress verify |
||||
|
||||
# Get the size down |
||||
/bin/rm -rf /var/lib/apt/lists |
@ -1,18 +0,0 @@ |
||||
version: '3' |
||||
services: |
||||
citest: |
||||
image: "debian:buster-slim" |
||||
user: root |
||||
volumes: |
||||
- ../scripts:/root/scripts |
||||
- ../install:/root/install |
||||
- ${HOME}/.ssh:/root/.ssh |
||||
- ../../..:/root/grafana-toolkit |
||||
cibuilt: |
||||
image: "grafana/grafana-plugin-ci-e2e" |
||||
user: root |
||||
volumes: |
||||
- ../scripts:/root/scripts |
||||
- ../install:/root/install |
||||
- ${HOME}/.ssh:/root/.ssh |
||||
- ../../..:/root/grafana-toolkit |
@ -1,14 +0,0 @@ |
||||
#!/bin/bash |
||||
|
||||
function finish { |
||||
echo "Exiting and cleaning up docker image" |
||||
docker-compose down |
||||
} |
||||
trap finish EXIT |
||||
|
||||
# Enter the docker container |
||||
if [ "$1" = "built" ]; then |
||||
docker-compose run cibuilt sh -c "cd /root; exec bash --login -i" |
||||
else |
||||
docker-compose run citest sh -c "cd /root; exec bash --login -i" |
||||
fi |
@ -1,8 +0,0 @@ |
||||
FROM debian:testing-20210111-slim |
||||
USER root |
||||
COPY scripts scripts |
||||
WORKDIR scripts |
||||
RUN apt-get update && \ |
||||
apt-get install -y wget && \ |
||||
./deploy.sh |
||||
COPY install/gget /usr/local/bin/gget |
@ -1,71 +0,0 @@ |
||||
# Using this docker image |
||||
|
||||
Currently tagged and uploaded to dockerhub as srclosson/integrations-ci-build |
||||
|
||||
Based off of `circleci/node:12-browsers` |
||||
|
||||
## User |
||||
|
||||
The user will be `circleci` |
||||
The home directory will be `/home/circleci` |
||||
|
||||
## Node |
||||
|
||||
- node 12 is installed |
||||
- yarn is installed globally |
||||
- npm is installed globally |
||||
|
||||
## Go |
||||
|
||||
- Go is installed in `/usr/local/bin/go` |
||||
- golangci-lint is installed in `/usr/local/bin/golangci-lint` |
||||
- mage is installed in `/home/circleci/go/bin/mage` |
||||
|
||||
All of the above directories are in the path, so there is no need to specify fully qualified paths. |
||||
|
||||
## Grafana |
||||
|
||||
- Installed in `/home/circleci/src/grafana` |
||||
- `yarn install` has been run |
||||
|
||||
## Integration/Release Testing |
||||
|
||||
There are 4 previous versions pre-downloaded to /usr/local/grafana. These versions are: |
||||
|
||||
1. 6.6.2 |
||||
2. 6.5.3 |
||||
3. 6.4.5 |
||||
4. 6.3.7 |
||||
|
||||
To test, your CircleCI config will need a run section with something similar to the following |
||||
|
||||
``` |
||||
- run: |
||||
name: Setup Grafana (local install) |
||||
command: | |
||||
sudo dpkg -i /usr/local/grafana/deb/grafana_6.6.2_amd64.deb |
||||
sudo cp ci/grafana-test-env/custom.ini /usr/share/grafana/conf/custom.ini |
||||
sudo cp ci/grafana-test-env/custom.ini /etc/grafana/grafana.ini |
||||
sudo service grafana-server start |
||||
grafana-cli --version |
||||
``` |
||||
|
||||
# Building |
||||
|
||||
To build, cd to `<srcroot>/packages/grafana-toolkit/docker/grafana-plugin-ci` |
||||
|
||||
``` |
||||
./build.sh |
||||
``` |
||||
|
||||
# Developing/Testing |
||||
|
||||
To test, you should have docker-compose installed. |
||||
|
||||
``` |
||||
cd test |
||||
./start.sh |
||||
``` |
||||
|
||||
You will be in /home/circleci/test with the buildscripts installed to the local directory. |
||||
Do your edits/run tests. When saving, your edits will be available in the container immediately. |
@ -1,8 +0,0 @@ |
||||
#!/bin/bash |
||||
set -eo pipefail |
||||
|
||||
source ./common.sh |
||||
|
||||
docker build -t ${DOCKER_IMAGE_NAME} . |
||||
docker push $DOCKER_IMAGE_NAME |
||||
|
@ -1,8 +0,0 @@ |
||||
#!/bin/bash |
||||
|
||||
## |
||||
## Common variable declarations |
||||
## Find the latest tags on https://hub.docker.com/r/grafana/grafana-plugin-ci/tags |
||||
## |
||||
|
||||
DOCKER_IMAGE_NAME="grafana/grafana-plugin-ci:1.6.1" |
@ -1,63 +0,0 @@ |
||||
#!/bin/bash |
||||
## |
||||
# gget |
||||
# A script to get and install grafana versions |
||||
# for usage information see "show_help" below. |
||||
# |
||||
|
||||
latest=$(curl -s 'https://raw.githubusercontent.com/grafana/grafana/main/latest.json' | jq -r '.stable') |
||||
canary=$(curl -s "https://grafana.com/api/grafana/versions" | jq ".items[0].version" | tr -d '"') |
||||
|
||||
show_help() { |
||||
echo "Usage: gget <version>" |
||||
echo "" |
||||
echo "where <version> can be:" |
||||
echo " 1) A version from https://grafana.com/grafana/download (ex x.y.z)" |
||||
echo " 2) latest (currently $latest)" |
||||
echo " 3) canary (currently $canary)" |
||||
echo "" |
||||
echo " -h, --help: Display this help message" |
||||
echo "" |
||||
exit 0 |
||||
} |
||||
|
||||
opts=$(getopt -o h --long help -n 'gget' -- "$@") |
||||
[ $? -eq 0 ] || { |
||||
show_help |
||||
} |
||||
|
||||
eval set -- "$opts" |
||||
while true; do |
||||
case "$1" in |
||||
-h | --help) |
||||
show_help |
||||
;; |
||||
--) |
||||
shift |
||||
break |
||||
;; |
||||
*) |
||||
break |
||||
;; |
||||
esac |
||||
shift |
||||
done |
||||
|
||||
[ -z "$1" ] && show_help |
||||
|
||||
# Make sure the script is being run as root |
||||
if [ $EUID -ne 0 ]; then |
||||
echo "This script must be run as root" |
||||
exit 1 |
||||
fi |
||||
|
||||
## |
||||
# MAIN |
||||
# |
||||
# Enough setup, let's actually do something |
||||
# |
||||
version=$1 |
||||
[ "$version" == "latest" ] && version="$latest" |
||||
[ "$version" == "canary" ] && version="$canary" |
||||
wget "https://dl.grafana.com/oss/release/grafana_${version}_amd64.deb" -O "/tmp/grafana_${version}_amd64.deb" |
||||
dpkg -i "/tmp/grafana_${version}_amd64.deb" && /bin/rm -rfv "/tmp/grafana_${version}_amd64.deb" |
@ -1,38 +0,0 @@ |
||||
#!/bin/bash |
||||
|
||||
## |
||||
# Script to deploy a docker image. Must return exit code 0 |
||||
# |
||||
do_exit() { |
||||
message="$1" |
||||
exit_code="$2" |
||||
|
||||
echo "$message" |
||||
exit $exit_code |
||||
} |
||||
|
||||
|
||||
## |
||||
# Get file, get's a file, validates the SHA |
||||
# @param filename |
||||
# @param expected sha value |
||||
# @returns 0 if successful, -1 of checksum validation failed. |
||||
# |
||||
get_file () { |
||||
[ -n "$1" ] && url=$1 || do_exit "url required" -1 |
||||
[ -n "$2" ] && dest=$2 || do_exit "destination required" -2 |
||||
sha=$3 |
||||
file=$(basename $dest) |
||||
|
||||
wget "$url" -O "$dest" |
||||
if [ -n "$sha" ]; then |
||||
echo "$sha $dest" | sha256sum --check --status || do_exit "Checksum validation failed for $file. Exiting" -1 |
||||
fi |
||||
} |
||||
|
||||
untar_file () { |
||||
[ -n "$1" ] && src=$1 || do_exit "src required" -1 |
||||
[ -n "$2" ] && dest=$2 || dest="/usr/local" |
||||
|
||||
tar -C "$dest" -xf "$src" && /bin/rm -rf "$src" |
||||
} |
@ -1,3 +0,0 @@ |
||||
#!/bin/bash |
||||
source "./deploy-common.sh" |
||||
|
@ -1,57 +0,0 @@ |
||||
#!/bin/bash |
||||
source "./deploy-common.sh" |
||||
|
||||
# Install Go |
||||
filename="go1.19.4.linux-amd64.tar.gz" |
||||
get_file "https://dl.google.com/go/$filename" "/tmp/$filename" "c9c08f783325c4cf840a94333159cc937f05f75d36a8b307951d5bd959cf2ab8" |
||||
untar_file "/tmp/$filename" |
||||
|
||||
# Install golangci-lint |
||||
GOLANGCILINT_VERSION=1.50.0 |
||||
filename="golangci-lint-${GOLANGCILINT_VERSION}-linux-amd64" |
||||
get_file "https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCILINT_VERSION}/$filename.tar.gz" \ |
||||
"/tmp/$filename.tar.gz" \ |
||||
"b4b329efcd913082c87d0e9606711ecb57415b5e6ddf233fde9e76c69d9b4e8b" |
||||
untar_file "/tmp/$filename.tar.gz" |
||||
ln -s /usr/local/${filename}/golangci-lint /usr/local/bin/golangci-lint |
||||
ln -s /usr/local/go/bin/go /usr/local/bin/go |
||||
ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt |
||||
chmod 755 /usr/local/bin/golangci-lint |
||||
|
||||
# Install dependencies |
||||
apt-get update -y && apt-get install -y adduser libfontconfig1 locate && /bin/rm -rf /var/lib/apt/lists/* |
||||
|
||||
# Install code climate |
||||
get_file "https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64" \ |
||||
"/usr/local/bin/cc-test-reporter" \ |
||||
"20d1d4e2b399d0287d91e65faeee8ffbef08e3262b0be5eda7def7b3c2799ddd" |
||||
chmod 755 /usr/local/bin/cc-test-reporter |
||||
|
||||
wget -O /usr/local/bin/grabpl "https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.9.27/grabpl" |
||||
chmod +x /usr/local/bin/grabpl |
||||
|
||||
# Install Mage |
||||
mkdir -pv /tmp/mage $HOME/go/bin |
||||
git clone https://github.com/magefile/mage.git /tmp/mage |
||||
pushd /tmp/mage && go run bootstrap.go && popd |
||||
mv $HOME/go/bin/mage /usr/local/bin |
||||
|
||||
GOOGLE_SDK_VERSION=365.0.1 |
||||
GOOGLE_SDK_CHECKSUM=17003cdba67a868c2518ac16efa60dc6175533b7a9fb87304459784308e30fb0 |
||||
|
||||
curl -fLO https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GOOGLE_SDK_VERSION}-linux-x86_64.tar.gz |
||||
echo "${GOOGLE_SDK_CHECKSUM} google-cloud-sdk-${GOOGLE_SDK_VERSION}-linux-x86_64.tar.gz" | sha256sum --check --status |
||||
tar xvzf google-cloud-sdk-${GOOGLE_SDK_VERSION}-linux-x86_64.tar.gz -C /opt |
||||
rm google-cloud-sdk-${GOOGLE_SDK_VERSION}-linux-x86_64.tar.gz |
||||
ln -s /opt/google-cloud-sdk/bin/gsutil /usr/bin/gsutil |
||||
ln -s /opt/google-cloud-sdk/bin/gcloud /usr/bin/gcloud |
||||
|
||||
# Cleanup after yourself |
||||
/bin/rm -rf /tmp/mage |
||||
/bin/rm -rf $HOME/go |
||||
|
||||
# Perform user specific initialization |
||||
sudo -u circleci ./deploy-user.sh |
||||
|
||||
# Get the size down |
||||
/bin/rm -rf /var/lib/apt/lists |
@ -1,10 +0,0 @@ |
||||
version: '3' |
||||
services: |
||||
citest: |
||||
image: "circleci/node:12-browsers" |
||||
user: root |
||||
volumes: |
||||
- ../scripts:/home/circleci/scripts |
||||
- ../install:/home/circleci/install |
||||
- ${HOME}/.ssh:/root/.ssh |
||||
- ../../..:/home/circleci/grafana-toolkit |
@ -1,10 +0,0 @@ |
||||
#!/bin/bash |
||||
|
||||
function finish { |
||||
echo "Exiting and cleaning up docker image" |
||||
docker-compose down |
||||
} |
||||
trap finish EXIT |
||||
|
||||
# Enter the docker container |
||||
docker-compose run citest bash -c "cd /home/circleci; exec bash --login -i" |
Loading…
Reference in new issue