Skip to content

Commit

Permalink
Fork master -> 2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
codyrancher committed Sep 7, 2021
1 parent e3992d8 commit 9b6c4e6
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 29 deletions.
70 changes: 63 additions & 7 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ steps:
exclude:
- tag

- name: build
- name: build-latest
pull: default
image: rancher/dapper:v0.4.1
commands:
Expand All @@ -33,31 +33,87 @@ steps:
path: /var/run/docker.sock
when:
branch:
- master
- 2.6-fixes
event:
exclude:
- pull_request
- tag

- name: upload
- name: upload-latest-2-6
pull: default
image: plugins/gcs
settings:
acl:
- allUsers:READER
cache_control: "no-cache,must-revalidate"
source: dist/static/latest2
target: releases.rancher.com/ui/latest2
source: dist/static/latest-2.6
target: releases.rancher.com/ui/latest-2.6
token:
from_secret: google_auth_key
when:
branch:
- master
- 2.6-fixes
event:
exclude:
- pull_request
- tag

- name: build-release
pull: default
image: rancher/dapper:v0.4.1
commands:
- dapper ci
environment:
ENVIRONMENT: production
privileged: true
volumes:
- name: docker
path: /var/run/docker.sock
when:
event:
- tag
ref:
include:
- "refs/tags/v2.6.*"


- name: upload-release
pull: default
image: plugins/gcs
settings:
acl:
- allUsers:READER
cache_control: "no-cache,must-revalidate"
source: dist/static/${DRONE_TAG##v}
target: releases.rancher.com/ui/${DRONE_TAG##v}
token:
from_secret: google_auth_key
when:
event:
- tag
ref:
include:
- "refs/tags/v2.6.*"

- name: upload-release-tar
pull: default
image: plugins/gcs
settings:
acl:
- allUsers:READER
cache_control: "no-cache,must-revalidate"
source: dist/static/${DRONE_TAG##v}.tar.gz
target: releases.rancher.com/ui/${DRONE_TAG##v}.tar.gz
token:
from_secret: google_auth_key
when:
event:
- tag
ref:
include:
- "refs/tags/v2.6.*"

volumes:
- name: docker
host:
path: /var/run/docker.sock
path: /var/run/docker.sock
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/latest-2.6` so that it's available at https://your-server.com/latest-2.6
- 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 "latest-2.6" part with the `-v` flag
- Change the value of https://your-rancher/v3/settings/ui-index to the same `https://your-server.com/latest-2.6` URL

### Running Tests

Expand Down
10 changes: 8 additions & 2 deletions config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -52,7 +58,7 @@ module.exports = function(environment) {
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true
// e.g. 'with-controller': true
},
EXTEND_PROTOTYPES: {
// Prevent Ember Data from overriding Date.parse.
Expand Down Expand Up @@ -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: '/',
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ui",
"version": "master-dev",
"version": "2.6-dev",
"private": true,
"repository": "https://github.com/rancher/ui",
"license": "Apache-2.0",
Expand Down Expand Up @@ -149,4 +149,4 @@
"lib/shared"
]
}
}
}
22 changes: 14 additions & 8 deletions scripts/build-static
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ if [[ -n "${BUILD_DEBUG}" ]]; then
set -x
fi

# Initialize empty variables
: ${CI_BRANCH=""}
: ${UPLOAD_LATEST=""}
# Drone will set this on tag
: ${CI_BUILD_TAG="${DRONE_TAG:-}"}

# cd to app root
CWD=$(dirname $0)
Expand All @@ -27,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 "latest-2.6" instead of the version in package.json
-t - Tag and push tag
-u - Upload to GCE
-s - Skip tests
Expand All @@ -42,17 +45,20 @@ EOF

# Parse options
BRANCH=$CI_BRANCH
BUILD_TAG="${CI_BUILD_TAG#v}"
CDN="releases.rancher.com/ui"

# Parse branch argument and set to current branch name if empty
if [[ -z "$BRANCH" ]]; then
BRANCH=$(git symbolic-ref HEAD | sed -e "s/^refs\/heads\///")
fi

if [[ -z "$BRANCH" ]]; then
BRANCH="master"
if [[ -z "$BUILD_TAG" ]]; then
PKG_VERSION=$(cat package.json | grep version | head -n 1 | cut -f4 -d'"')
else
PKG_VERSION="$BUILD_TAG"
fi

PKG_VERSION=$(cat package.json | grep version | head -n 1 | cut -f4 -d'"')
FORCE=0
LATEST=0
MODE=""
Expand Down Expand Up @@ -119,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}" == "2.6-fixes" ]] && [[ "${UPLOAD_LATEST}" == "true" ]]; then
UPLOAD=2
LATEST=1
fi
Expand All @@ -132,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}" != "2.6-fixes" ]]; then
echo "You can only tag or upload the 2.6-fixes branch (you are on '${BRANCH}')."
if [[ $FORCE -ne 1 ]]; then
exit 1;
fi
Expand All @@ -151,7 +157,7 @@ if [[ "${FORCE_VERSION}" != "" ]]; then
VERSION=${FORCE_VERSION}
else
if [[ $LATEST -eq 1 ]]; then
VERSION="latest2"
VERSION="2.6-fixes"
else
VERSION=${PKG_VERSION}
fi
Expand Down
26 changes: 19 additions & 7 deletions scripts/ci
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
set -e

BUILD_DEBUG="${BUILD_DEBUG:-}"
CI_BUILD_TAG="${DRONE_TAG:-}"
CI_BUILD_TAG="${CI_BUILD_TAG#v}"

echo "CI_BUILD_TAG ${CI_BUILD_TAG}..."


if [[ -n "${BUILD_DEBUG}" ]]; then
set -x
env
set -x
env
fi

# cd to app root
Expand All @@ -21,14 +27,20 @@ rm -rf node_modules build dist tmp
echo "Bootstrapping.."
./scripts/bootstrap

echo "Linting.."
./node_modules/.bin/eslint --max-warnings 0 .
if [[ -z "${CI_BUILD_TAG}" ]]; then
echo "Linting.."
./node_modules/.bin/eslint --max-warnings 0 .
fi

if [[ "${BUILD_LATEST}" == "true" ]]; then
echo "Building..."
./scripts/build-static -l -v latest2
echo "Building latest..."
./scripts/build-static -l -v latest-2.6
# (build-static contains a call to test & build)
elif [[ ! -z "${CI_BUILD_TAG}" ]]; then
echo "Building v${CI_BUILD_TAG}..."
./scripts/build-static -s -v "${CI_BUILD_TAG}"
# (build-static contains a call to test & build)
else
echo "Testing.."
echo "Testing..."
yarn test
fi

0 comments on commit 9b6c4e6

Please sign in to comment.