Commit d910f69b by Leonard Gram Committed by GitHub

CI: Enterprise MSI (#21518)

* build: builds msi for enterprise

* build: renamed msi generator directory

* build: build and deploy enterprise msi

* Build: placeholder license file for enterprise

* Build: correct name for ee msi
parent aa0982da
...@@ -992,6 +992,33 @@ jobs: ...@@ -992,6 +992,33 @@ jobs:
command: './scripts/ci-job-succeeded.sh' command: './scripts/ci-job-succeeded.sh'
when: on_success when: on_success
build-ee-msi:
docker:
- image: grafana/wix-toolset-ci:v3
steps:
- checkout
- run:
name: ci job started
command: './scripts/ci-job-started.sh'
- attach_workspace:
at: .
- run:
name: Build EE MSI
command: './scripts/build/ci-msi-build/ci-msi-build-ee.sh'
- persist_to_workspace:
root: .
paths:
- enterprise-dist/grafana-*.msi
- enterprise-dist/grafana-*.msi.sha256
- run:
name: ci job failed
command: './scripts/ci-job-failed.sh'
when: on_fail
- run:
name: ci job succeeded
command: './scripts/ci-job-succeeded.sh'
when: on_success
store-build-artifacts: store-build-artifacts:
docker: docker:
- image: circleci/node:12 - image: circleci/node:12
...@@ -1172,6 +1199,7 @@ workflows: ...@@ -1172,6 +1199,7 @@ workflows:
- mysql-integration-test - mysql-integration-test
- postgres-integration-test - postgres-integration-test
- build-all-enterprise - build-all-enterprise
- build-ee-msi
filters: *filter-only-master filters: *filter-only-master
- build-oss-msi: - build-oss-msi:
requires: requires:
...@@ -1183,6 +1211,16 @@ workflows: ...@@ -1183,6 +1211,16 @@ workflows:
- shellcheck - shellcheck
- mysql-integration-test - mysql-integration-test
- postgres-integration-test - postgres-integration-test
- build-ee-msi:
requires:
- build-all-enterprise
- test-backend
- test-frontend
- codespell
- lint-go
- shellcheck
- mysql-integration-test
- postgres-integration-test
filters: *filter-only-master filters: *filter-only-master
- end-to-end-test: - end-to-end-test:
requires: requires:
...@@ -1237,6 +1275,7 @@ workflows: ...@@ -1237,6 +1275,7 @@ workflows:
- shellcheck - shellcheck
- mysql-integration-test - mysql-integration-test
- postgres-integration-test - postgres-integration-test
- build-ee-msi
filters: *filter-only-release filters: *filter-only-release
- grafana-docker-release: - grafana-docker-release:
requires: requires:
...@@ -1284,6 +1323,16 @@ workflows: ...@@ -1284,6 +1323,16 @@ workflows:
- shellcheck - shellcheck
- mysql-integration-test - mysql-integration-test
- postgres-integration-test - postgres-integration-test
- build-ee-msi:
requires:
- build-all-enterprise
- test-backend
- test-frontend
- codespell
- lint-go
- shellcheck
- mysql-integration-test
- postgres-integration-test
filters: *filter-only-release filters: *filter-only-release
- end-to-end-test-release: - end-to-end-test-release:
requires: requires:
......
FROM grafana/wix-toolset-ci:v3
RUN mkdir -p /tmp/dist /tmp/cache && \
cd /tmp/dist && \
wget https://dl.grafana.com/enterprise/release/grafana-enterprise-6.5.1.windows-amd64.zip && \
unzip -l grafana-enterprise-6.5.1.windows-amd64.zip
COPY . /package-grafana
WORKDIR /package-grafana
RUN cp ./msigenerator/cache/nssm-2.24.zip /tmp/cache
RUN cd msigenerator && python3 generator/build.py -e
...@@ -10,7 +10,7 @@ ls -al /tmp/dist ...@@ -10,7 +10,7 @@ ls -al /tmp/dist
# nssm download has been unreliable, use a cached copy of it # nssm download has been unreliable, use a cached copy of it
echo "Caching NSSM" echo "Caching NSSM"
mkdir -p /tmp/cache mkdir -p /tmp/cache
cp ./scripts/build/ci-msi-build/oss/cache/nssm-2.24.zip /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 # a build can be specified, which will be pulled down
#python3 generator/build.py --build 5.4.3 #python3 generator/build.py --build 5.4.3
#echo "LIGHT config" #echo "LIGHT config"
...@@ -18,7 +18,7 @@ cp ./scripts/build/ci-msi-build/oss/cache/nssm-2.24.zip /tmp/cache ...@@ -18,7 +18,7 @@ cp ./scripts/build/ci-msi-build/oss/cache/nssm-2.24.zip /tmp/cache
#cat /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 #cp ./scripts/build/ci-msi-build/oss/light.exe.config /home/xclient/wix/light.exe.config
#cat /home/xclient/wix/light.exe.config #cat /home/xclient/wix/light.exe.config
cd ./scripts/build/ci-msi-build/oss cd ./scripts/build/ci-msi-build/msigenerator
echo "Building MSI" echo "Building MSI"
python3 generator/build.py "$@" python3 generator/build.py "$@"
chmod a+x /tmp/scratch/*.msi chmod a+x /tmp/scratch/*.msi
......
...@@ -103,7 +103,7 @@ def remove_long_paths(): ...@@ -103,7 +103,7 @@ def remove_long_paths():
print('Skipped: {}'.format(file)) print('Skipped: {}'.format(file))
def build_oss(zip_file, extracted_name, PRODUCT_VERSION, config, features): def build_msi(zip_file, extracted_name, PRODUCT_VERSION, config, features, is_enterprise):
# keep reference to source directory, will need to switch back and # keep reference to source directory, will need to switch back and
# forth during the process # forth during the process
src_dir = os.getcwd() src_dir = os.getcwd()
...@@ -112,6 +112,7 @@ def build_oss(zip_file, extracted_name, PRODUCT_VERSION, config, features): ...@@ -112,6 +112,7 @@ def build_oss(zip_file, extracted_name, PRODUCT_VERSION, config, features):
os.mkdir('/tmp/a') os.mkdir('/tmp/a')
target_dir_name = '/tmp/a' target_dir_name = '/tmp/a'
extract_zip(zip_file, target_dir_name) 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, # the zip file contains a version, which will not work when upgrading,
# and ends up with paths longer # and ends up with paths longer
# than light.exe can parse (windows issue) # than light.exe can parse (windows issue)
...@@ -229,8 +230,13 @@ def build_oss(zip_file, extracted_name, PRODUCT_VERSION, config, features): ...@@ -229,8 +230,13 @@ def build_oss(zip_file, extracted_name, PRODUCT_VERSION, config, features):
os.system(cmd) os.system(cmd)
except Exception as ex: except Exception as ex:
print(ex) print(ex)
# copy to scratch with version included # copy to scratch with version included
msi_filename = '/tmp/scratch/{}.windows-amd64.msi'.format(extracted_name) msi_filename = '/tmp/scratch/grafana-{}.windows-amd64.msi'.format(PRODUCT_VERSION)
if is_enterprise:
msi_filename = '/tmp/scratch/grafana-enterprise-{}.windows-amd64.msi'.format(PRODUCT_VERSION)
shutil.copy2('grafana.msi', msi_filename) shutil.copy2('grafana.msi', msi_filename)
os.system('ls -al /tmp/scratch') os.system('ls -al /tmp/scratch')
print('LIGHT COMPLETE') print('LIGHT COMPLETE')
...@@ -238,25 +244,36 @@ def build_oss(zip_file, extracted_name, PRODUCT_VERSION, config, features): ...@@ -238,25 +244,36 @@ def build_oss(zip_file, extracted_name, PRODUCT_VERSION, config, features):
# extract_dir.cleanup() # extract_dir.cleanup()
def main(file_loader, env, grafana_version, zip_file, extracted_name): def main(file_loader, env, grafana_version, zip_file, extracted_name, is_enterprise):
UPGRADE_VERSION = OSS_UPGRADE_VERSION UPGRADE_VERSION = OSS_UPGRADE_VERSION
GRAFANA_VERSION = grafana_version GRAFANA_VERSION = grafana_version
PRODUCT_NAME = OSS_PRODUCT_NAME PRODUCT_TITLE = OSS_PRODUCT_NAME
PRODUCT_NAME = 'GrafanaOSS'
# PRODUCT_VERSION=GRAFANA_VERSION # PRODUCT_VERSION=GRAFANA_VERSION
# MSI version cannot have anything other # MSI version cannot have anything other
# than a x.x.x.x format, numbers only # than a x.x.x.x format, numbers only
PRODUCT_VERSION = GRAFANA_VERSION.split('-')[0] 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 = { config = {
'grafana_version': PRODUCT_VERSION, 'grafana_version': PRODUCT_VERSION,
'upgrade_code': UPGRADE_VERSION, 'upgrade_code': UPGRADE_VERSION,
'product_name': PRODUCT_NAME, 'product_name': PRODUCT_NAME,
'manufacturer': 'Grafana Labs' 'manufacturer': 'Grafana Labs',
'license': LICENSE
} }
features = [ features = [
{ {
'name': 'GrafanaOSS', 'name': PRODUCT_NAME,
'title': PRODUCT_NAME, 'title': PRODUCT_TITLE,
'component_groups': [ 'component_groups': [
{ {
'ref_id': 'GrafanaX64', 'ref_id': 'GrafanaX64',
...@@ -275,7 +292,7 @@ def main(file_loader, env, grafana_version, zip_file, extracted_name): ...@@ -275,7 +292,7 @@ def main(file_loader, env, grafana_version, zip_file, extracted_name):
] ]
} }
] ]
build_oss(zip_file, extracted_name, PRODUCT_VERSION, config, features) build_msi(zip_file, extracted_name, PRODUCT_VERSION, config, features, is_enterprise)
if __name__ == '__main__': if __name__ == '__main__':
...@@ -313,7 +330,7 @@ if __name__ == '__main__': ...@@ -313,7 +330,7 @@ if __name__ == '__main__':
grafana_version, grafana_hash, is_enterprise = detect_version(DIST_LOCATION) grafana_version, grafana_hash, is_enterprise = detect_version(DIST_LOCATION)
# check for enterprise flag # check for enterprise flag
if args.enterprise: if args.enterprise and args.build:
grafana_version = 'enterprise-{}'.format(args.build) grafana_version = 'enterprise-{}'.format(args.build)
# #
print('Detected Version: {}'.format(grafana_version)) print('Detected Version: {}'.format(grafana_version))
...@@ -322,7 +339,7 @@ if __name__ == '__main__': ...@@ -322,7 +339,7 @@ if __name__ == '__main__':
print('Enterprise: {}'.format(is_enterprise)) print('Enterprise: {}'.format(is_enterprise))
if is_enterprise: if is_enterprise:
zip_file = '{}/grafana-enterprise-{}.windows-amd64.zip'.format(DIST_LOCATION, grafana_version) zip_file = '{}/grafana-enterprise-{}.windows-amd64.zip'.format(DIST_LOCATION, grafana_version)
extracted_name = 'grafana-enterprise-{}'.format(grafana_version) extracted_name = 'grafana-{}'.format(grafana_version)
else: else:
# the file can have a build hash # the file can have a build hash
if grafana_hash: if grafana_hash:
...@@ -336,4 +353,4 @@ if __name__ == '__main__': ...@@ -336,4 +353,4 @@ if __name__ == '__main__':
if not os.path.isfile(zip_file): if not os.path.isfile(zip_file):
zip_file = get_zip(grafana_version, zip_file) zip_file = get_zip(grafana_version, zip_file)
main(file_loader, env, grafana_version, zip_file, extracted_name) main(file_loader, env, grafana_version, zip_file, extracted_name, is_enterprise)
...@@ -50,10 +50,12 @@ def detect_version(dist_path): ...@@ -50,10 +50,12 @@ def detect_version(dist_path):
print('Skipping detection, no matches') print('Skipping detection, no matches')
return return
firstFile = fileList[0] firstFile = fileList[0]
p1 = re.search(r'grafana-(\d\.\d\.\d)\.windows-amd64.zip$', firstFile) p1 = re.search(r'grafana-(enterprise-)?(\d\.\d\.\d)\.windows-amd64.zip$', firstFile)
p2 = re.search(r'grafana-(\d\.\d\.\d)-(.*)\.windows-amd64.zip$', firstFile) p2 = re.search(r'grafana-(\d\.\d\.\d)-(.*)\.windows-amd64.zip$', firstFile)
if p1: if p1:
detectedVersion = p1.group(1) detectedVersion = p1.group(2)
if p1.group(1) == 'enterprise-':
isEnterprise = True
if p2: if p2:
detectedVersion = p2.group(1) detectedVersion = p2.group(1)
detectedHash = p2.group(2) detectedHash = p2.group(2)
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<Icon Id="icon.ico" SourceFile="grafana_icon.ico"/> <Icon Id="icon.ico" SourceFile="grafana_icon.ico"/>
<WixVariable Id="WixUILicenseRtf" Value="LICENSE.rtf" /> <WixVariable Id="WixUILicenseRtf" Value="{{config.license}}" />
<WixVariable Id="WixUIBannerBmp" Value="grafana_top_banner_white.bmp" /> <WixVariable Id="WixUIBannerBmp" Value="grafana_top_banner_white.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="grafana_dialog_background.bmp" /> <WixVariable Id="WixUIDialogBmp" Value="grafana_dialog_background.bmp" />
......
#!/bin/bash
_image="ee-msi-build"
_container="ee-build"
docker build -t $_image .
docker run --rm -d --name $_container $_image sleep 100
docker cp $_container:/tmp/dist .
docker stop $_container
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment