mirror of https://github.com/grafana/grafana
Scripts/Build: Remove unused CI folders (#103374)
* Scripts/Build: Remove ci-deploy * Scripts/Build: Remove ci-e2e * Scripts/Build: Remove ci-windows-test * Scripts/Build: Remove ci-wix * Scripts/Build: Remove ci-msi-build * Dependabot: Remove unused folders from docker updates * Chore: Run make update-workspacepull/103285/head^2
parent
5c3769bc2d
commit
c7754d7065
@ -1,58 +0,0 @@ |
||||
FROM debian:testing-20210111-slim |
||||
|
||||
# Use ARG so as not to persist environment variable in image |
||||
ARG GOVERSION=1.17.8 \ |
||||
GO_CHECKSUM=980e65a863377e69fd9b67df9d8395fd8e93858e7a24c9f55803421e453f4f99 \ |
||||
DEBIAN_FRONTEND=noninteractive |
||||
|
||||
ENV PATH=/usr/local/go/bin:$PATH \ |
||||
GOPATH=/go |
||||
|
||||
RUN apt update && apt install -yq curl git make |
||||
RUN curl -fLO https://storage.googleapis.com/golang/go${GOVERSION}.linux-amd64.tar.gz && \ |
||||
echo "${GO_CHECKSUM} go${GOVERSION}.linux-amd64.tar.gz" | sha256sum --check --strict --status && \ |
||||
tar -xzf go${GOVERSION}.linux-amd64.tar.gz -C /usr/local |
||||
|
||||
RUN git clone https://github.com/aptly-dev/aptly $GOPATH/src/github.com/aptly-dev/aptly |
||||
RUN cd $GOPATH/src/github.com/aptly-dev/aptly && \ |
||||
# pin aptly to a specific commit after 1.3.0 that contains gpg2 support |
||||
git reset --hard a64807efdaf5e380bfa878c71bc88eae10d62be1 && \ |
||||
make install |
||||
|
||||
FROM debian:testing-20210111-slim |
||||
|
||||
# Use ARG so as not to persist environment variable in image |
||||
ARG DEBIAN_FRONTEND=noninteractive \ |
||||
GOOGLE_SDK_VERSION=325.0.0 \ |
||||
GOOGLE_SDK_CHECKSUM=374f960c9f384f88b6fc190b268ceac5dcad777301390107af63782bfb5ecbc7 |
||||
|
||||
# Install python 3.7, as 3.10 is not working (see https://stackoverflow.com/questions/69779995/solving-an-attribute-error-found-while-installing-or-building-on-google-cloud-pl) |
||||
RUN apt update && apt install -y build-essential libsqlite3-dev zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev curl libbz2-dev && \ |
||||
curl -O https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz && \ |
||||
tar -xf Python-3.7.3.tar.xz && \ |
||||
cd Python-3.7.3 && \ |
||||
./configure --enable-optimizations && \ |
||||
make -j 8 && \ |
||||
make altinstall && \ |
||||
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ |
||||
python3.7 get-pip.py |
||||
|
||||
ENV CLOUDSDK_PYTHON=/usr/local/bin/python3.7 |
||||
|
||||
# Need procps for pkill utility, which is used by the build pipeline tool to restart the GPG agent |
||||
RUN apt update && apt install -yq git procps && pip3 install -U awscli crcmod && \ |
||||
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 xzf 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 && \ |
||||
apt update && \ |
||||
apt install -y createrepo-c expect && \ |
||||
apt-get autoremove -y && \ |
||||
rm -rf /var/lib/apt/lists/* && \ |
||||
ln -s /opt/google-cloud-sdk/bin/gsutil /usr/bin/gsutil && \ |
||||
ln -s /opt/google-cloud-sdk/bin/gcloud /usr/bin/gcloud && \ |
||||
mkdir -p /deb-repo /rpm-repo && \ |
||||
ln -s /usr/bin/createrepo_c /usr/bin/createrepo && \ |
||||
gcloud components update |
||||
|
||||
COPY --from=0 /go/bin/aptly /usr/local/bin/aptly |
@ -1,8 +0,0 @@ |
||||
#!/bin/bash |
||||
set -eo pipefail |
||||
|
||||
_version="1.3.1" |
||||
_tag="grafana/grafana-ci-deploy:${_version}" |
||||
|
||||
docker build -t $_tag . |
||||
docker push $_tag |
@ -1,11 +0,0 @@ |
||||
FROM node:12.19.0-buster-slim |
||||
|
||||
WORKDIR /root |
||||
|
||||
RUN apt-get update && apt-get install -yq gnupg netcat curl git |
||||
RUN curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add - && \ |
||||
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list && \ |
||||
# Cypress dependencies |
||||
apt-get update && apt-get install -yq libgtk2.0-0 libgtk-3-0 libnotify-dev libgconf-2-4 libnss3 libxss1 \ |
||||
libasound2 libxtst6 xauth xvfb google-chrome-stable && \ |
||||
apt-get autoremove -y && rm -rf /var/lib/apt/lists/* |
@ -1,13 +0,0 @@ |
||||
FROM grafana/wix-toolset-ci:v3 |
||||
|
||||
RUN mkdir -p /tmp/dist /tmp/cache && \ |
||||
cd /tmp/dist && \ |
||||
wget https://dl.grafana.com/enterprise/main/grafana-enterprise-6.6.0-ca61af52pre.windows-amd64.zip && \ |
||||
unzip -l *.zip |
||||
|
||||
COPY . /package-grafana |
||||
WORKDIR /package-grafana |
||||
|
||||
RUN cp ./msigenerator/cache/nssm-2.24.zip /tmp/cache |
||||
|
||||
RUN cd msigenerator && python3 generator/build.py |
@ -1,46 +0,0 @@ |
||||
# Grafana MSI Generator |
||||
|
||||
Creates a docker image that can be included within CircleCI or run locally to generate an MSI for Grafana. |
||||
|
||||
## Docker Image |
||||
|
||||
The docker image is created and published via CircleCI, and can also be built locally. |
||||
|
||||
The image is self contained with all of the code in `/master`. |
||||
The detection process expects a zip file in `/master/dist`. |
||||
|
||||
There are two patterns that will be matched for a build in the dist directory: |
||||
|
||||
``` |
||||
grafana-6.0.0-ca0bc2c5pre3.windows-amd64.zip |
||||
grafana-5.4.3.windows-amd64.zip |
||||
``` |
||||
|
||||
### Building an MSI |
||||
|
||||
The process is automated to expect a dist directory, and will build an msi for first matching grafana-\*.windows-amd64.zip file found. |
||||
|
||||
``` |
||||
grafana-5.4.3.windows-amd64.zip |
||||
``` |
||||
|
||||
## CircleCI |
||||
|
||||
## Manual |
||||
|
||||
A wrapper script takes a single argument for the path to a zip file, or searches for a file in dist. |
||||
|
||||
A manual build can be initiated using docker-compose |
||||
|
||||
``` |
||||
cd oss |
||||
docker-compose up --build |
||||
``` |
||||
|
||||
## Automated |
||||
|
||||
## Testing |
||||
|
||||
## Change Log |
||||
|
||||
v1.0.0 - initial commit |
@ -1,29 +0,0 @@ |
||||
#!/bin/bash |
||||
set -e |
||||
WORKING_DIRECTORY=$(pwd) |
||||
DIST_DIRECTORY="$WORKING_DIRECTORY/enterprise-dist" |
||||
# copy zip file to /tmp/dist |
||||
mkdir -p /tmp/dist |
||||
cp ./enterprise-dist/*.zip /tmp/dist |
||||
echo "Contents of /tmp/dist" |
||||
ls -al /tmp/dist |
||||
|
||||
# nssm download has been unreliable, use a cached copy of it |
||||
echo "Caching NSSM" |
||||
mkdir -p /tmp/cache |
||||
cp ./scripts/build/ci-msi-build/msigenerator/cache/nssm-2.24.zip /tmp/cache |
||||
|
||||
cd ./scripts/build/ci-msi-build/msigenerator |
||||
echo "Building MSI" |
||||
python3 generator/build.py "$@" |
||||
chmod a+x /tmp/scratch/*.msi |
||||
echo "MSI: Copy to $DIST_DIRECTORY" |
||||
cp /tmp/scratch/*.msi "$DIST_DIRECTORY" |
||||
echo "MSI: Generate SHA256" |
||||
MSI_FILE=$(ls "${DIST_DIRECTORY}"/*.msi) |
||||
SHA256SUM=$(sha256sum "$MSI_FILE" | cut -f1 -d' ') |
||||
echo "$SHA256SUM" > "$MSI_FILE.sha256" |
||||
echo "MSI: SHA256 file content:" |
||||
cat "$MSI_FILE.sha256" |
||||
echo "MSI: contents of $DIST_DIRECTORY" |
||||
ls -al "$DIST_DIRECTORY" |
@ -1,34 +0,0 @@ |
||||
#!/bin/bash |
||||
set -e |
||||
WORKING_DIRECTORY=$(pwd) |
||||
# copy zip file to /tmp/dist |
||||
mkdir -p /tmp/dist |
||||
cp ./dist/*.zip /tmp/dist |
||||
echo "Contents of /tmp/dist" |
||||
ls -al /tmp/dist |
||||
|
||||
# nssm download has been unreliable, use a cached copy of it |
||||
echo "Caching NSSM" |
||||
mkdir -p /tmp/cache |
||||
cp ./scripts/build/ci-msi-build/msigenerator/cache/nssm-2.24.zip /tmp/cache |
||||
# a build can be specified, which will be pulled down |
||||
#python3 generator/build.py --build 5.4.3 |
||||
#echo "LIGHT config" |
||||
#ls -al /home/xclient/wix/light.exe.config |
||||
#cat /home/xclient/wix/light.exe.config |
||||
#cp ./scripts/build/ci-msi-build/oss/light.exe.config /home/xclient/wix/light.exe.config |
||||
#cat /home/xclient/wix/light.exe.config |
||||
cd ./scripts/build/ci-msi-build/msigenerator |
||||
echo "Building MSI" |
||||
python3 generator/build.py "$@" |
||||
chmod a+x /tmp/scratch/*.msi |
||||
echo "MSI: Copy to $WORKING_DIRECTORY/dist" |
||||
cp /tmp/scratch/*.msi "$WORKING_DIRECTORY/dist" |
||||
echo "MSI: Generate SHA256" |
||||
MSI_FILE=$(ls "$WORKING_DIRECTORY"/dist/*.msi) |
||||
SHA256SUM=$(sha256sum "$MSI_FILE" | cut -f1 -d' ') |
||||
echo "$SHA256SUM" > "$MSI_FILE.sha256" |
||||
echo "MSI: SHA256 file content:" |
||||
cat "$MSI_FILE.sha256" |
||||
echo "MSI: contents of $WORKING_DIRECTORY/dist" |
||||
ls -al "$WORKING_DIRECTORY/dist" |
@ -1,5 +0,0 @@ |
||||
all: build |
||||
|
||||
build: |
||||
pip3 install -r requirements.txt
|
||||
python3 generator/build.py
|
Binary file not shown.
@ -1,28 +0,0 @@ |
||||
#!/bin/bash |
||||
|
||||
# Build will be found in ./dist and ./dist-enterprise |
||||
# integrated circleci will have all of the code in /master |
||||
# and the builds will be found in $HOME |
||||
mkdir -p /tmp/dist |
||||
if [ -d '/home/xclient/repo/dist/' ]; then |
||||
ls -al /home/xclient/repo/dist/ |
||||
cp /home/xclient/repo/dist/*.zip /tmp/dist/ |
||||
echo "Contents of /tmp/dist" |
||||
ls -al /tmp/dist |
||||
fi |
||||
# nssm download has been unreliable, use a cached copy of it |
||||
echo "Caching NSSM" |
||||
mkdir -p /tmp/cache |
||||
cp /master/cache/nssm-2.24.zip /tmp/cache |
||||
# a build can be specified, which will be pulled down |
||||
#python3 generator/build.py --build 5.4.3 |
||||
echo "LIGHT config" |
||||
ls -al /home/xclient/wix/light.exe.config |
||||
cat /home/xclient/wix/light.exe.config |
||||
cp /master/light.exe.config /home/xclient/wix/light.exe.config |
||||
cat /home/xclient/wix/light.exe.config |
||||
cd /master || exit 1 |
||||
echo "Building MSI" |
||||
python3 generator/build.py "$@" |
||||
# |
||||
# |
@ -1,13 +0,0 @@ |
||||
version: '3' |
||||
services: |
||||
wix: |
||||
build: './docker' |
||||
command: /oss/wrapper.sh |
||||
# important: wine is setup for the user xclient |
||||
user: xclient |
||||
volumes: |
||||
- ../oss:/oss |
||||
- ../master/templates:/oss/templates |
||||
- ../master/resources:/oss/resources |
||||
environment: |
||||
- TERM=linux |
@ -1,356 +0,0 @@ |
||||
#!/usr/bin/env python |
||||
# |
||||
# Creates .wxs files to be used to generate multiple MSI targets |
||||
# |
||||
# by default the script will check for dist and enterprise-dist, and parse |
||||
# the version as needed options are provided to give a build version that will |
||||
# download the zip, drop in to dist/enterprise-dist and do the same thing |
||||
# |
||||
# Expected paths and names |
||||
# /tmp/dist/grafana-6.0.0-ca0bc2c5pre3.windows-amd64.zip |
||||
# /tmp/enterprise-dist/grafana-enterprise-6.0.0-29b28127pre3.windows-amd64.zip |
||||
# |
||||
# Optionally (mainly for testing), pass arguments to pull a specific build |
||||
# -b,--build 5.4.3 |
||||
# -e,--enterprise add this flag to specify enterprise |
||||
# -p,--premium, add this flag to include premium plugins |
||||
# |
||||
# When using the build option, the zip file is created in either dist or |
||||
# dist-enterprise according to the -e flag toggle. |
||||
# |
||||
# https://s3-us-west-2.amazonaws.com/grafana-releases/release/ |
||||
# grafana-{}.windows-amd64.zip |
||||
# |
||||
# https://dl.grafana.com/enterprise/release/ |
||||
# grafana-enterprise-{}.windows-amd64.zip |
||||
# |
||||
import os |
||||
import shutil |
||||
import argparse |
||||
from jinja2 import Environment, FileSystemLoader |
||||
|
||||
from utils import * |
||||
|
||||
############################# |
||||
# Constants - DO NOT CHANGE # |
||||
############################# |
||||
OSS_UPGRADE_VERSION = '35c7d2a9-6e23-4645-b975-e8693a1cef10' |
||||
OSS_PRODUCT_NAME = 'Grafana OSS' |
||||
ENTERPRISE_UPGRADE_VERSION = 'd534ec50-476b-4edc-a25e-fe854c949f4f' |
||||
ENTERPRISE_PRODUCT_NAME = 'Grafana Enterprise' |
||||
|
||||
############################# |
||||
# CONSTANTS |
||||
############################# |
||||
MSI_GENERATOR_VERSION = '1.0.0' |
||||
############################# |
||||
# PATHS |
||||
############################# |
||||
WIX_HOME = '/home/xclient/wix' |
||||
WINE_CMD = '/usr/bin/wine64' # or just wine for 32bit |
||||
CANDLE = '{} {}/candle.exe'.format(WINE_CMD, WIX_HOME) |
||||
LIGHT = '{} {}/light.exe'.format(WINE_CMD, WIX_HOME) |
||||
HEAT = '{} {}/heat.exe'.format(WINE_CMD, WIX_HOME) |
||||
NSSM_VERSION = '2.24' |
||||
DIST_LOCATION = '/tmp/dist' |
||||
############################# |
||||
# |
||||
############################# |
||||
grafana_oss = { |
||||
'feature_component_group_refs': [ |
||||
'GrafanaX64', |
||||
'GrafanaServiceX64', |
||||
'GrafanaFirewallExceptionsGroup' |
||||
], |
||||
'directory_refs': [ |
||||
'GrafanaX64Dir' |
||||
], |
||||
'components': [ |
||||
'grafana.wxs', |
||||
'grafana-service.wxs', |
||||
'grafana-firewall.wxs' |
||||
] |
||||
} |
||||
|
||||
|
||||
# |
||||
# Grafana 6 includes new datasources with long paths |
||||
# |
||||
def remove_long_paths(): |
||||
print('Removing long pathed files - these are not needed to run grafana') |
||||
long_files = [ |
||||
'/tmp/a/grafana/public/app/plugins/datasource/grafana-azure-monitor-datasource/app_insights/app_insights_querystring_builder.test.ts', |
||||
'/tmp/a/grafana/public/app/plugins/datasource/grafana-azure-monitor-datasource/app_insights/app_insights_querystring_builder.ts', |
||||
'/tmp/a/grafana/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_log_analytics/azure_log_analytics_datasource.test.ts', |
||||
'/tmp/a/grafana/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_log_analytics/azure_log_analytics_datasource.ts', |
||||
'/tmp/a/grafana/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.test.ts', |
||||
'/tmp/a/grafana/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.ts', |
||||
'/tmp/a/grafana/public/app/plugins/datasource/grafana-azure-monitor-datasource/app_insights/app_insights_datasource.ts', |
||||
'/tmp/a/grafana/public/app/plugins/datasource/grafana-azure-monitor-datasource/app_insights/app_insights_datasource.test.ts', |
||||
'/tmp/a/grafana/public/app/plugins/datasource/grafana-azure-monitor-datasource/insights_analytics/insights_analytics_datasource.ts', |
||||
'/tmp/a/grafana/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_filter_builder.test.ts', |
||||
'/tmp/a/grafana/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_filter_builder.ts', |
||||
'/tmp/a/grafana/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/AnalyticsConfig.test.tsx', |
||||
'/tmp/a/grafana/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/AzureCredentialsForm.test.tsx', |
||||
'/tmp/a/grafana/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/InsightsConfig.test.tsx', |
||||
'/tmp/a/grafana/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/__snapshots__/AnalyticsConfig.test.tsx.snap', |
||||
'/tmp/a/grafana/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/__snapshots__/AzureCredentialsForm.test.tsx.snap', |
||||
'/tmp/a/grafana/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/__snapshots__/InsightsConfig.test.tsx.snap', |
||||
'/tmp/a/grafana/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/__snapshots__/ConfigEditor.test.tsx.snap' |
||||
] |
||||
for file in long_files: |
||||
if os.path.isfile(file): |
||||
print('Removing: {}'.format(file)) |
||||
os.remove(file) |
||||
else: |
||||
print('Skipped: {}'.format(file)) |
||||
|
||||
|
||||
def build_msi(zip_file, extracted_name, PRODUCT_VERSION, grafana_hash, config, features, is_enterprise): |
||||
# keep reference to source directory, will need to switch back and |
||||
# forth during the process |
||||
src_dir = os.getcwd() |
||||
# target_dir = tempfile.TemporaryDirectory() |
||||
if not os.path.isdir('/tmp/a'): |
||||
os.mkdir('/tmp/a') |
||||
target_dir_name = '/tmp/a' |
||||
extract_zip(zip_file, target_dir_name) |
||||
os.system('ls -al /tmp/a') |
||||
# the zip file contains a version, which will not work when upgrading, |
||||
# and ends up with paths longer |
||||
# than light.exe can parse (windows issue) |
||||
# Once extracted, rename it to grafana without the version included |
||||
zip_file_path = '{}/{}'.format(target_dir_name, extracted_name) |
||||
rename_to = '{}/grafana'.format(target_dir_name) |
||||
print('Renaming extracted path {} to {}'.format(zip_file_path, rename_to)) |
||||
os.system('ls -al /tmp/a') |
||||
print('Before:') |
||||
os.rename(zip_file_path, rename_to) |
||||
print('After:') |
||||
os.system('ls -al /tmp/a') |
||||
# cleanup due to MSI API limitation |
||||
remove_long_paths() |
||||
# |
||||
# HEAT |
||||
# |
||||
# Collects the files from the path given and generates wxs file |
||||
# |
||||
print('Heat Harvesting') |
||||
cgname = 'GrafanaX64' |
||||
cgdir = 'GrafanaX64Dir' |
||||
if not os.path.isdir('/tmp/scratch'): |
||||
os.mkdir('/tmp/scratch') |
||||
os.chdir('/tmp/scratch') |
||||
outfile = 'grafana-oss.wxs' |
||||
# important flags |
||||
# -srd - prevents the parent directory name from being included in the |
||||
# harvest |
||||
# -cg - component group to be referenced in main wxs file |
||||
# -fr - directory ref to be used in main wxs file |
||||
try: |
||||
cmd = ''' |
||||
{} dir {} \ |
||||
-platform x64 \ |
||||
-sw5150 \ |
||||
-srd \ |
||||
-cg {} \ |
||||
-gg \ |
||||
-sfrag \ |
||||
-dr {} \ |
||||
-template fragment \ |
||||
-out {}'''.strip().format(HEAT, target_dir_name, cgname, cgdir, outfile) |
||||
print(cmd) |
||||
os.system(cmd) |
||||
except Exception as ex: |
||||
print(ex) |
||||
|
||||
shutil.copy2(outfile, target_dir_name) |
||||
nssm_file = get_nssm('/tmp/cache', NSSM_VERSION) |
||||
if not os.path.isdir(target_dir_name + '/nssm'): |
||||
os.mkdir(target_dir_name + '/nssm') |
||||
extract_zip(nssm_file, target_dir_name + '/nssm') |
||||
print('HARVEST COMPLETE') |
||||
os.chdir(src_dir) |
||||
generate_firewall_wxs(env, PRODUCT_VERSION, '/tmp/scratch/grafana-firewall.wxs', target_dir_name) |
||||
generate_service_wxs(env, PRODUCT_VERSION, '/tmp/scratch/grafana-service.wxs', target_dir_name, NSSM_VERSION) |
||||
generate_product_wxs(env, config, features, '/tmp/scratch/product.wxs', target_dir_name) |
||||
print('GENERATE COMPLETE') |
||||
copy_static_files(target_dir_name) |
||||
print('COPY STATIC COMPLETE') |
||||
# |
||||
# CANDLE needs to run in the scratch dir |
||||
os.chdir('/tmp/scratch') |
||||
try: |
||||
filename = 'grafana-service.wxs' |
||||
cmd = '{} -ext WixFirewallExtension -ext WixUtilExtension -v -arch x64 {}'.format(CANDLE, filename) |
||||
print(cmd) |
||||
os.system(cmd) |
||||
shutil.copy2('grafana-service.wixobj', target_dir_name) |
||||
# |
||||
filename = 'grafana-firewall.wxs' |
||||
cmd = '{} -ext WixFirewallExtension -ext WixUtilExtension -v -arch x64 {}'.format( |
||||
CANDLE, |
||||
filename) |
||||
print(cmd) |
||||
os.system(cmd) |
||||
shutil.copy2('grafana-firewall.wixobj', target_dir_name) |
||||
# |
||||
filename = 'grafana-oss.wxs' |
||||
cmd = '{} -ext WixFirewallExtension -ext WixUtilExtension -v -arch x64 {}'.format( |
||||
CANDLE, |
||||
filename) |
||||
print(cmd) |
||||
os.system(cmd) |
||||
shutil.copy2('grafana-oss.wixobj', target_dir_name) |
||||
# |
||||
filename = 'product.wxs' |
||||
cmd = '{} -ext WixFirewallExtension -ext WixUtilExtension -v -arch x64 {}'.format( |
||||
CANDLE, |
||||
filename) |
||||
print(cmd) |
||||
os.system(cmd) |
||||
shutil.copy2('product.wixobj', target_dir_name) |
||||
except Exception as ex: |
||||
print(ex) |
||||
print('CANDLE COMPLETE') |
||||
############################ |
||||
# LIGHT - Assemble the MSI |
||||
############################ |
||||
os.chdir(target_dir_name) |
||||
os.system('cp -pr nssm/nssm-2.24 .') |
||||
try: |
||||
cmd = ''' |
||||
{} \ |
||||
-cultures:en-US \ |
||||
-ext WixUIExtension.dll -ext WixFirewallExtension -ext WixUtilExtension \ |
||||
-v -sval -spdb \ |
||||
grafana-service.wixobj \ |
||||
grafana-firewall.wixobj \ |
||||
grafana-oss.wixobj \ |
||||
product.wixobj \ |
||||
-out grafana.msi'''.strip().format(LIGHT) |
||||
print(cmd) |
||||
os.system(cmd) |
||||
except Exception as ex: |
||||
print(ex) |
||||
|
||||
hash = '' |
||||
if grafana_hash: |
||||
hash = '-{}'.format(grafana_hash) |
||||
|
||||
# copy to scratch with version included |
||||
msi_filename = '/tmp/scratch/grafana-{}{}.windows-amd64.msi'.format(PRODUCT_VERSION, hash) |
||||
|
||||
if is_enterprise: |
||||
msi_filename = '/tmp/scratch/grafana-enterprise-{}{}.windows-amd64.msi'.format(PRODUCT_VERSION, hash) |
||||
|
||||
shutil.copy2('grafana.msi', msi_filename) |
||||
os.system('ls -al /tmp/scratch') |
||||
print('LIGHT COMPLETE') |
||||
# finally cleanup |
||||
# extract_dir.cleanup() |
||||
|
||||
|
||||
def main(file_loader, env, grafana_version, grafana_hash, zip_file, extracted_name, is_enterprise): |
||||
UPGRADE_VERSION = OSS_UPGRADE_VERSION |
||||
GRAFANA_VERSION = grafana_version |
||||
PRODUCT_TITLE = OSS_PRODUCT_NAME |
||||
PRODUCT_NAME = 'GrafanaOSS' |
||||
# PRODUCT_VERSION=GRAFANA_VERSION |
||||
# MSI version cannot have anything other |
||||
# than a x.x.x.x format, numbers only |
||||
PRODUCT_VERSION = GRAFANA_VERSION.split('-')[0] |
||||
LICENSE = 'LICENSE.rtf' |
||||
|
||||
|
||||
if is_enterprise: |
||||
UPGRADE_VERSION = ENTERPRISE_UPGRADE_VERSION |
||||
PRODUCT_TITLE = ENTERPRISE_PRODUCT_NAME |
||||
PRODUCT_NAME = 'GrafanaEnterprise' |
||||
LICENSE = 'EE_LICENSE.rtf' |
||||
|
||||
|
||||
config = { |
||||
'grafana_version': PRODUCT_VERSION, |
||||
'upgrade_code': UPGRADE_VERSION, |
||||
'product_name': PRODUCT_NAME, |
||||
'manufacturer': 'Grafana Labs', |
||||
'license': LICENSE |
||||
} |
||||
features = [ |
||||
{ |
||||
'name': PRODUCT_NAME, |
||||
'title': PRODUCT_TITLE, |
||||
'component_groups': [ |
||||
{ |
||||
'ref_id': 'GrafanaX64', |
||||
'directory': 'GrafanaX64Dir' |
||||
} |
||||
] |
||||
}, |
||||
{ |
||||
'name': 'GrafanaService', |
||||
'title': 'Run Grafana as a Service', |
||||
'component_groups': [ |
||||
{ |
||||
'ref_id': 'GrafanaServiceX64', |
||||
'directory': 'GrafanaServiceX64Dir' |
||||
} |
||||
] |
||||
} |
||||
] |
||||
build_msi(zip_file, extracted_name, PRODUCT_VERSION, grafana_hash, config, features, is_enterprise) |
||||
|
||||
|
||||
if __name__ == '__main__': |
||||
print('MSI Generator Version: {}'.format(MSI_GENERATOR_VERSION)) |
||||
|
||||
parser = argparse.ArgumentParser( |
||||
description='Grafana MSI Generator', |
||||
formatter_class=lambda prog: argparse.HelpFormatter(prog, max_help_position=90, width=110), add_help=True) |
||||
parser.add_argument( |
||||
'-p', |
||||
'--premium', |
||||
help='Include premium plugins', |
||||
dest='premium', action='store_true') |
||||
parser.add_argument('-b', '--build', help='build to download') |
||||
args = parser.parse_args() |
||||
file_loader = FileSystemLoader('templates') |
||||
env = Environment(loader=file_loader) |
||||
grafana_version = None |
||||
grafana_hash = None |
||||
is_enterprise = False |
||||
if not os.path.isdir(DIST_LOCATION): |
||||
os.mkdir(DIST_LOCATION) |
||||
# if a build version is specified, pull it |
||||
if args.build: |
||||
grafana_version = args.build |
||||
print('Version Specified: {}'.format(grafana_version)) |
||||
else: |
||||
grafana_version, grafana_hash, is_enterprise = detect_version(DIST_LOCATION) |
||||
|
||||
print('Detected Version: {}'.format(grafana_version)) |
||||
if grafana_hash: |
||||
print('Detected Hash: {}'.format(grafana_hash)) |
||||
print('Enterprise: {}'.format(is_enterprise)) |
||||
if is_enterprise: |
||||
if grafana_hash: |
||||
zip_file = '{}/grafana-enterprise-{}-{}.windows-amd64.zip'.format(DIST_LOCATION, grafana_version, grafana_hash) |
||||
extracted_name = 'grafana-{}-{}'.format(grafana_version, grafana_hash) |
||||
else: |
||||
zip_file = '{}/grafana-enterprise-{}.windows-amd64.zip'.format(DIST_LOCATION, grafana_version) |
||||
extracted_name = 'grafana-{}'.format(grafana_version) |
||||
else: |
||||
# the file can have a build hash |
||||
if grafana_hash: |
||||
zip_file = '{}/grafana-{}-{}.windows-amd64.zip'.format(DIST_LOCATION, grafana_version, grafana_hash) |
||||
extracted_name = 'grafana-{}-{}'.format(grafana_version, grafana_hash) |
||||
else: |
||||
zip_file = '{}/grafana-{}.windows-amd64.zip'.format(DIST_LOCATION, grafana_version) |
||||
extracted_name = 'grafana-{}'.format(grafana_version) |
||||
print('ZipFile: {}'.format(zip_file)) |
||||
# check if file downloaded |
||||
|
||||
if not os.path.isfile(zip_file): |
||||
zip_file = get_zip(grafana_version, zip_file) |
||||
main(file_loader, env, grafana_version, grafana_hash, zip_file, extracted_name, is_enterprise) |
@ -1,126 +0,0 @@ |
||||
import zipfile |
||||
import os |
||||
import glob |
||||
import re |
||||
import shutil |
||||
import wget |
||||
|
||||
|
||||
def extract_zip(filename, target_dir): |
||||
with zipfile.ZipFile(filename, 'r') as zip_ref: |
||||
zip_ref.extractall(target_dir) |
||||
|
||||
|
||||
def get_nssm(tmpPath, version): |
||||
if not os.path.isdir(tmpPath): |
||||
os.mkdir(tmpPath) |
||||
target_filename = '{}/nssm-{}.zip'.format(tmpPath, version) |
||||
exists = os.path.isfile(target_filename) |
||||
if exists: |
||||
return target_filename |
||||
url = 'https://nssm.cc/release/nssm-{}.zip'.format(version) |
||||
print('NSSM url is {}'.format(url)) |
||||
filename = wget.download(url, out=target_filename, bar=wget.bar_thermometer) |
||||
return filename |
||||
|
||||
|
||||
def get_zip(version, target_filename): |
||||
exists = os.path.isfile(target_filename) |
||||
if exists: |
||||
return target_filename |
||||
url = 'https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-{}.windows-amd64.zip'.format(version) |
||||
#url = 'https://dl.grafana.com/enterprise/release/grafana-enterprise-{}.windows-amd64.zip'.format(version) |
||||
filename = wget.download(url, out=target_filename, bar=wget.bar_thermometer) |
||||
return filename |
||||
|
||||
|
||||
# |
||||
# |
||||
# |
||||
def detect_version(dist_path): |
||||
detectedVersion = '' |
||||
detectedHash = '' |
||||
isEnterprise = False |
||||
print("Detecting Version...") |
||||
# grafana-6.0.0-ca0bc2c5pre3.windows-amd64.zip |
||||
# get files in directory matching pattern |
||||
fileList = glob.glob(dist_path + '/grafana*.windows-amd64.zip') |
||||
print(fileList) |
||||
if len(fileList) == 0: |
||||
print('Skipping detection, no matches') |
||||
return |
||||
firstFile = fileList[0] |
||||
p1 = re.search(r'grafana-(enterprise-)?(\d\.\d\.\d)-(.+)\.windows-amd64\.zip$', firstFile) |
||||
p2 = re.search(r'grafana-(enterprise-)?(\d\.\d\.\d)\.windows-amd64\.zip$', firstFile) |
||||
if p1: |
||||
detectedVersion = p1.group(2) |
||||
detectedHash = p1.group(3) |
||||
if p1.group(1) == 'enterprise-': |
||||
isEnterprise = True |
||||
if p2: |
||||
detectedVersion = p2.group(2) |
||||
if p2.group(1) == 'enterprise-': |
||||
isEnterprise = True |
||||
|
||||
return detectedVersion, detectedHash, isEnterprise |
||||
|
||||
#if os.path.isdir(dist_path + 'enterprise-dist'): |
||||
# # grafana-enterprise-6.0.0-29b28127pre3.windows-amd64.zip |
||||
# # get files in directory matching pattern |
||||
# fileList = glob.glob(dist_path + '/enterprise-dist/grafana*.windows-amd64.zip') |
||||
# firstFile = fileList[0] |
||||
# p1 = re.search(r'grafana-enterprise-(\d\.\d\.\d)\.windows-amd64.zip$', firstFile) |
||||
# p2 = re.search(r'grafana-enterprise-(\d\.\d\.\d)-(.*)\.windows-amd64.zip$', firstFile) |
||||
# if p1: |
||||
# detectedVersion = p1.group(1) |
||||
# isEnterprise = True |
||||
# if p2: |
||||
# detectedVersion = p2.group(1) |
||||
# detectedHash = p2.group(2) |
||||
# isEnterprise = True |
||||
# return detectedVersion, detectedHash, isEnterprise |
||||
|
||||
|
||||
def generate_product_wxs(env, config, features, scratch_file, target_dir): |
||||
template = env.get_template('common/product.wxs.j2') |
||||
output = template.render(config=config, features=features) |
||||
fh = open(scratch_file, 'w') |
||||
fh.write(output) |
||||
fh.close() |
||||
shutil.copy2(scratch_file, target_dir) |
||||
|
||||
def generate_service_wxs(env, grafana_version, scratch_file, target_dir, nssm_version='2.24'): |
||||
template = env.get_template('common/grafana-service.wxs.j2') |
||||
output = template.render(grafana_version=grafana_version, nssm_version=nssm_version) |
||||
fh = open(scratch_file, 'w') |
||||
fh.write(output) |
||||
fh.close() |
||||
shutil.copy2(scratch_file, target_dir) |
||||
|
||||
def generate_firewall_wxs(env, grafana_version, scratch_file, target_dir): |
||||
os.system("ls -al templates") |
||||
template = env.get_template('common/grafana-firewall.wxs.j2') |
||||
output = template.render(grafana_version=grafana_version) |
||||
fh = open(scratch_file, 'w') |
||||
fh.write(output) |
||||
fh.close() |
||||
shutil.copy2(scratch_file, target_dir) |
||||
|
||||
|
||||
def generate_oracle_environment_wxs(env, instant_client_version, scratch_file, target_dir): |
||||
template = env.get_template('oracle/oracle-environment.wxs.j2') |
||||
output = template.render(instant_client_version=instant_client_version) |
||||
fh = open(scratch_file, 'w') |
||||
fh.write(output) |
||||
fh.close() |
||||
shutil.copy2(scratch_file, target_dir) |
||||
|
||||
def copy_static_files(target_dir): |
||||
for item in os.listdir('resources/images'): |
||||
s = os.path.join('resources/images', item) |
||||
d = os.path.join(target_dir, item) |
||||
shutil.copy2(s, d) |
||||
for item in os.listdir('resources/license'): |
||||
s = os.path.join('resources/license', item) |
||||
d = os.path.join(target_dir, item) |
||||
shutil.copy2(s, d) |
@ -1,13 +0,0 @@ |
||||
<?xml version="1.0" encoding="utf-8" ?> |
||||
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> |
||||
|
||||
<configuration> |
||||
<startup useLegacyV2RuntimeActivationPolicy="true"> |
||||
<supportedRuntime version="v4.0" /> |
||||
<supportedRuntime version="v2.0.50727" /> |
||||
</startup> |
||||
<runtime> |
||||
<loadFromRemoteSources enabled="true"/> |
||||
<AppContextSwitchOverrides value="Switch.System.IO.UseLegacyPathHandling=false;Switch.System.IO.BlockLongPaths=false" /> |
||||
</runtime> |
||||
</configuration> |
@ -1,3 +0,0 @@ |
||||
Jinja2>=2.10 |
||||
MarkupSafe>=1.1.0 |
||||
wget>=3.2 |
Before Width: | Height: | Size: 601 KiB |
Before Width: | Height: | Size: 261 KiB |
Before Width: | Height: | Size: 254 KiB |
Before Width: | Height: | Size: 112 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 112 KiB |
File diff suppressed because it is too large
Load Diff
@ -1,201 +0,0 @@ |
||||
Apache License |
||||
Version 2.0, January 2004 |
||||
http://www.apache.org/licenses/ |
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION |
||||
|
||||
1. Definitions. |
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, |
||||
and distribution as defined by Sections 1 through 9 of this document. |
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by |
||||
the copyright owner that is granting the License. |
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all |
||||
other entities that control, are controlled by, or are under common |
||||
control with that entity. For the purposes of this definition, |
||||
"control" means (i) the power, direct or indirect, to cause the |
||||
direction or management of such entity, whether by contract or |
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the |
||||
outstanding shares, or (iii) beneficial ownership of such entity. |
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity |
||||
exercising permissions granted by this License. |
||||
|
||||
"Source" form shall mean the preferred form for making modifications, |
||||
including but not limited to software source code, documentation |
||||
source, and configuration files. |
||||
|
||||
"Object" form shall mean any form resulting from mechanical |
||||
transformation or translation of a Source form, including but |
||||
not limited to compiled object code, generated documentation, |
||||
and conversions to other media types. |
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or |
||||
Object form, made available under the License, as indicated by a |
||||
copyright notice that is included in or attached to the work |
||||
(an example is provided in the Appendix below). |
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object |
||||
form, that is based on (or derived from) the Work and for which the |
||||
editorial revisions, annotations, elaborations, or other modifications |
||||
represent, as a whole, an original work of authorship. For the purposes |
||||
of this License, Derivative Works shall not include works that remain |
||||
separable from, or merely link (or bind by name) to the interfaces of, |
||||
the Work and Derivative Works thereof. |
||||
|
||||
"Contribution" shall mean any work of authorship, including |
||||
the original version of the Work and any modifications or additions |
||||
to that Work or Derivative Works thereof, that is intentionally |
||||
submitted to Licensor for inclusion in the Work by the copyright owner |
||||
or by an individual or Legal Entity authorized to submit on behalf of |
||||
the copyright owner. For the purposes of this definition, "submitted" |
||||
means any form of electronic, verbal, or written communication sent |
||||
to the Licensor or its representatives, including but not limited to |
||||
communication on electronic mailing lists, source code control systems, |
||||
and issue tracking systems that are managed by, or on behalf of, the |
||||
Licensor for the purpose of discussing and improving the Work, but |
||||
excluding communication that is conspicuously marked or otherwise |
||||
designated in writing by the copyright owner as "Not a Contribution." |
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity |
||||
on behalf of whom a Contribution has been received by Licensor and |
||||
subsequently incorporated within the Work. |
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of |
||||
this License, each Contributor hereby grants to You a perpetual, |
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
||||
copyright license to reproduce, prepare Derivative Works of, |
||||
publicly display, publicly perform, sublicense, and distribute the |
||||
Work and such Derivative Works in Source or Object form. |
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of |
||||
this License, each Contributor hereby grants to You a perpetual, |
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
||||
(except as stated in this section) patent license to make, have made, |
||||
use, offer to sell, sell, import, and otherwise transfer the Work, |
||||
where such license applies only to those patent claims licensable |
||||
by such Contributor that are necessarily infringed by their |
||||
Contribution(s) alone or by combination of their Contribution(s) |
||||
with the Work to which such Contribution(s) was submitted. If You |
||||
institute patent litigation against any entity (including a |
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work |
||||
or a Contribution incorporated within the Work constitutes direct |
||||
or contributory patent infringement, then any patent licenses |
||||
granted to You under this License for that Work shall terminate |
||||
as of the date such litigation is filed. |
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the |
||||
Work or Derivative Works thereof in any medium, with or without |
||||
modifications, and in Source or Object form, provided that You |
||||
meet the following conditions: |
||||
|
||||
(a) You must give any other recipients of the Work or |
||||
Derivative Works a copy of this License; and |
||||
|
||||
(b) You must cause any modified files to carry prominent notices |
||||
stating that You changed the files; and |
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works |
||||
that You distribute, all copyright, patent, trademark, and |
||||
attribution notices from the Source form of the Work, |
||||
excluding those notices that do not pertain to any part of |
||||
the Derivative Works; and |
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its |
||||
distribution, then any Derivative Works that You distribute must |
||||
include a readable copy of the attribution notices contained |
||||
within such NOTICE file, excluding those notices that do not |
||||
pertain to any part of the Derivative Works, in at least one |
||||
of the following places: within a NOTICE text file distributed |
||||
as part of the Derivative Works; within the Source form or |
||||
documentation, if provided along with the Derivative Works; or, |
||||
within a display generated by the Derivative Works, if and |
||||
wherever such third-party notices normally appear. The contents |
||||
of the NOTICE file are for informational purposes only and |
||||
do not modify the License. You may add Your own attribution |
||||
notices within Derivative Works that You distribute, alongside |
||||
or as an addendum to the NOTICE text from the Work, provided |
||||
that such additional attribution notices cannot be construed |
||||
as modifying the License. |
||||
|
||||
You may add Your own copyright statement to Your modifications and |
||||
may provide additional or different license terms and conditions |
||||
for use, reproduction, or distribution of Your modifications, or |
||||
for any such Derivative Works as a whole, provided Your use, |
||||
reproduction, and distribution of the Work otherwise complies with |
||||
the conditions stated in this License. |
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, |
||||
any Contribution intentionally submitted for inclusion in the Work |
||||
by You to the Licensor shall be under the terms and conditions of |
||||
this License, without any additional terms or conditions. |
||||
Notwithstanding the above, nothing herein shall supersede or modify |
||||
the terms of any separate license agreement you may have executed |
||||
with Licensor regarding such Contributions. |
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade |
||||
names, trademarks, service marks, or product names of the Licensor, |
||||
except as required for reasonable and customary use in describing the |
||||
origin of the Work and reproducing the content of the NOTICE file. |
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or |
||||
agreed to in writing, Licensor provides the Work (and each |
||||
Contributor provides its Contributions) on an "AS IS" BASIS, |
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
||||
implied, including, without limitation, any warranties or conditions |
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A |
||||
PARTICULAR PURPOSE. You are solely responsible for determining the |
||||
appropriateness of using or redistributing the Work and assume any |
||||
risks associated with Your exercise of permissions under this License. |
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, |
||||
whether in tort (including negligence), contract, or otherwise, |
||||
unless required by applicable law (such as deliberate and grossly |
||||
negligent acts) or agreed to in writing, shall any Contributor be |
||||
liable to You for damages, including any direct, indirect, special, |
||||
incidental, or consequential damages of any character arising as a |
||||
result of this License or out of the use or inability to use the |
||||
Work (including but not limited to damages for loss of goodwill, |
||||
work stoppage, computer failure or malfunction, or any and all |
||||
other commercial damages or losses), even if such Contributor |
||||
has been advised of the possibility of such damages. |
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing |
||||
the Work or Derivative Works thereof, You may choose to offer, |
||||
and charge a fee for, acceptance of support, warranty, indemnity, |
||||
or other liability obligations and/or rights consistent with this |
||||
License. However, in accepting such obligations, You may act only |
||||
on Your own behalf and on Your sole responsibility, not on behalf |
||||
of any other Contributor, and only if You agree to indemnify, |
||||
defend, and hold each Contributor harmless for any liability |
||||
incurred by, or claims asserted against, such Contributor by reason |
||||
of your accepting any such warranty or additional liability. |
||||
|
||||
END OF TERMS AND CONDITIONS |
||||
|
||||
APPENDIX: How to apply the Apache License to your work. |
||||
|
||||
To apply the Apache License to your work, attach the following |
||||
boilerplate notice, with the fields enclosed by brackets "[]" |
||||
replaced with your own identifying information. (Don't include |
||||
the brackets!) The text should be enclosed in the appropriate |
||||
comment syntax for the file format. We also recommend that a |
||||
file or class name and description of purpose be included on the |
||||
same "printed page" as the copyright notice for easier |
||||
identification within third-party archives. |
||||
|
||||
Copyright [yyyy] [name of copyright owner] |
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); |
||||
you may not use this file except in compliance with the License. |
||||
You may obtain a copy of the License at |
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0 |
||||
|
||||
Unless required by applicable law or agreed to in writing, software |
||||
distributed under the License is distributed on an "AS IS" BASIS, |
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
See the License for the specific language governing permissions and |
||||
limitations under the License. |