From 8303c8b10414fa6c41ccfdac17310a93733e3873 Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Thu, 22 Jun 2023 15:46:00 +0100 Subject: [PATCH] Updated build process to work from the new `release-2.7.5` branch - Used https://github.com/rancher/ui/pull/4896 as a template --- .drone.yml | 8 ++++---- README.md | 6 +++--- config/environment.js | 8 +++++++- package.json | 2 +- scripts/build-static | 10 +++++----- scripts/ci | 2 +- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/.drone.yml b/.drone.yml index fcee86f5e4..9f9e082c4b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -33,7 +33,7 @@ steps: path: /var/run/docker.sock when: branch: - - master + - release-2.7.5 event: exclude: - pull_request @@ -46,13 +46,13 @@ steps: acl: - allUsers:READER cache_control: "no-cache,must-revalidate" - source: dist/static/latest2 - target: releases.rancher.com/ui/latest2 + source: dist/static/release-2.7.5 + target: releases.rancher.com/ui/release-2.7.5 token: from_secret: google_auth_key when: branch: - - master + - release-2.7.5 event: exclude: - pull_request diff --git a/README.md b/README.md index 104f858629..adf3b81fa1 100644 --- a/README.md +++ b/README.md @@ -71,10 +71,10 @@ Rancher UI supports localization via translations files. You can swap translatio If you want to customize the UI, re-packaging all of Rancher to distribute the UI is possible but not terribly convenient. Instead you can change Cattle to load the UI source from a remote web server: - Build with `./scripts/build-static -l -c 'your-server.com'` -- Upload `./dist/static/latest2` so that it's available at https://your-server.com/latest2 +- Upload `./dist/static/release-2.7.5` so that it's available at https://your-server.com/release-2.7.5 - It must be available over HTTPS. - - You can rename the "latest2" part with the `-v` flag -- Change the value of https://your-rancher/v3/settings/ui-index to the same `https://your-server.com/latest2` URL + - You can rename the "release-2.7.5" part with the `-v` flag +- Change the value of https://your-rancher/v3/settings/ui-index to the same `https://your-server.com/release-2.7.5` URL ### Running Tests diff --git a/config/environment.js b/config/environment.js index 8ba1e187e4..815acf0c35 100644 --- a/config/environment.js +++ b/config/environment.js @@ -3,6 +3,12 @@ var pkg = require('../package.json'); var fs = require('fs'); var YAML = require('yamljs'); +var packageVersion = process.env.DRONE_TAG || pkg.version; + +if (packageVersion.startsWith('v')) { + packageVersion = packageVersion.slice(1); +} + // host can be an ip "1.2.3.4" -> https://1.2.3.4:30443 // or a URL+port function normalizeHost(host,defaultPort) { @@ -86,7 +92,7 @@ module.exports = function(environment) { APP: { // Here you can pass flags/options to your application instance // when it is created - version: pkg.version, + version: packageVersion, appName: 'Rancher', environment: environment, baseAssets: '/', diff --git a/package.json b/package.json index 92ca8bc959..0915aedfec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ui", - "version": "master-dev", + "version": "2.7.5-dev", "private": true, "repository": "https://github.com/rancher/ui", "license": "Apache-2.0", diff --git a/scripts/build-static b/scripts/build-static index 7268a6cc64..13b7045b8b 100755 --- a/scripts/build-static +++ b/scripts/build-static @@ -30,7 +30,7 @@ function printHelp() { build-static Usage: -d - Build debug instead of production build -f - Force: Turn off checks that prevent you from doing bad things - -l - Build as "latest2" instead of the version in package.json + -l - Build as "release-2.7.5" instead of the version in package.json -t - Tag and push tag -u - Upload to GCE -s - Skip tests @@ -125,7 +125,7 @@ if [[ `git status --porcelain` ]]; then fi # UPLOAD_LATEST=true is set by Drone for auto upload to CDN -if [[ "${BRANCH}" == "master" ]] && [[ "${UPLOAD_LATEST}" == "true" ]]; then +if [[ "${BRANCH}" == "release-2.7.5" ]] && [[ "${UPLOAD_LATEST}" == "true" ]]; then UPLOAD=2 LATEST=1 fi @@ -138,8 +138,8 @@ if [[ $LATEST -eq 1 ]] && [[ $TAG -eq 1 ]]; then fi fi -if ( [[ $TAG -eq 1 ]] || [[ $UPLOAD -ne 0 ]] ) && [[ "${BRANCH}" != "master" ]]; then - echo "You can only tag or upload the master branch (you are on '${BRANCH}')." +if ( [[ $TAG -eq 1 ]] || [[ $UPLOAD -ne 0 ]] ) && [[ "${BRANCH}" != "release-2.7.5" ]]; then + echo "You can only tag or upload the release-2.7.5 branch (you are on '${BRANCH}')." if [[ $FORCE -ne 1 ]]; then exit 1; fi @@ -157,7 +157,7 @@ if [[ "${FORCE_VERSION}" != "" ]]; then VERSION=${FORCE_VERSION} else if [[ $LATEST -eq 1 ]]; then - VERSION="latest2" + VERSION="release-2.7.5" else VERSION=${PKG_VERSION} fi diff --git a/scripts/ci b/scripts/ci index 3b00285fd8..6c282094a6 100755 --- a/scripts/ci +++ b/scripts/ci @@ -34,7 +34,7 @@ fi if [[ "${BUILD_LATEST}" == "true" ]]; then echo "Building latest..." - ./scripts/build-static -l -v latest2 + ./scripts/build-static -l -v release-2.7.5 # (build-static contains a call to test & build) elif [[ ! -z "${CI_BUILD_TAG}" ]]; then echo "Building v${CI_BUILD_TAG}..."