Browse Source

ci: fix bindata autoupdate (#8801)

* update bindata on ui-v2/ changes

* Revert "Remove GIT_SHA environment variable"

This reverts commit f620f9aefd.

* Revert "Hardcode in an app version for ember-cli-app-version"

This reverts commit 5ae493d79b.

* revert modtime change in #8712
pull/8816/head
Alvin Huang 4 years ago committed by GitHub
parent
commit
8b409529aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      .circleci/config.yml
  2. 2
      GNUmakefile
  3. 1
      ui-v2/app/components/hashicorp-consul/index.hbs
  4. 21
      ui-v2/config/environment.js

10
.circleci/config.yml

@ -641,10 +641,12 @@ jobs:
- attach_workspace:
at: .
- run:
name: commit agent/uiserver/bindata_assetfs.go if there are changes
name: commit agent/uiserver/bindata_assetfs.go if there are UI changes
command: |
exit 0
if ! git diff --exit-code agent/uiserver/bindata_assetfs.go; then
# check if there are any changes in ui-v2/
# if there are, we commit the ui static asset file
# HEAD^! is shorthand for HEAD^..HEAD (parent of HEAD and HEAD)
if ! git diff --quiet --exit-code HEAD^! ui-v2/; then
git config --local user.email "hashicorp-ci@users.noreply.github.com"
git config --local user.name "hashicorp-ci"
@ -653,7 +655,7 @@ jobs:
git commit -m "auto-updated agent/uiserver/bindata_assetfs.go from commit ${short_sha}"
git push origin master
else
echo "no new static assets to publish"
echo "no UI changes so no static assets to publish"
fi
- run: *notify-slack-failure

2
GNUmakefile

@ -306,7 +306,7 @@ lint:
# also run as part of the release build script when it verifies that there are no
# changes to the UI assets that aren't checked in.
static-assets:
@go-bindata-assetfs -modtime 1 -pkg uiserver -prefix pkg -o $(ASSETFS_PATH) ./pkg/web_ui/...
@go-bindata-assetfs -pkg uiserver -prefix pkg -o $(ASSETFS_PATH) ./pkg/web_ui/...
@go fmt $(ASSETFS_PATH)

1
ui-v2/app/components/hashicorp-consul/index.hbs

@ -249,4 +249,5 @@
<a data-test-footer-copyright href="{{env 'CONSUL_COPYRIGHT_URL'}}/" rel="noopener noreferrer" target="_blank">&copy; {{env 'CONSUL_COPYRIGHT_YEAR'}} HashiCorp</a>
<p data-test-footer-version>Consul {{env 'CONSUL_VERSION'}}</p>
<a data-test-footer-docs href="{{env 'CONSUL_DOCS_URL'}}" rel="help noopener noreferrer" target="_blank">Documentation</a>
{{{concat '<!-- ' (env 'CONSUL_GIT_SHA') '-->'}}}
</footer>

21
ui-v2/config/environment.js

@ -1,7 +1,7 @@
'use strict';
const fs = require('fs');
const path = require('path');
module.exports = function(environment, $ = process.env) {
module.exports = function (environment, $ = process.env) {
let ENV = {
modulePrefix: 'consul-ui',
environment,
@ -11,9 +11,6 @@ module.exports = function(environment, $ = process.env) {
// torii provider. We provide this object here to
// prevent ember from giving a log message when starting ember up
torii: {},
'ember-cli-app-version': {
version: 'consul-ui',
},
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
@ -37,7 +34,7 @@ module.exports = function(environment, $ = process.env) {
CONSUL_UI_DISABLE_REALTIME: typeof process.env.CONSUL_UI_DISABLE_REALTIME !== 'undefined',
CONSUL_UI_DISABLE_ANCHOR_SELECTION:
typeof process.env.CONSUL_UI_DISABLE_ANCHOR_SELECTION !== 'undefined',
CONSUL_COPYRIGHT_YEAR: (function(val) {
CONSUL_COPYRIGHT_YEAR: (function (val) {
if (val) {
return val;
}
@ -48,7 +45,17 @@ module.exports = function(environment, $ = process.env) {
.split('-')
.shift();
})(process.env.CONSUL_COPYRIGHT_YEAR),
CONSUL_VERSION: (function(val) {
CONSUL_GIT_SHA: (function (val) {
if (val) {
return val;
}
return require('child_process')
.execSync('git rev-parse --short HEAD')
.toString()
.trim();
})(process.env.CONSUL_GIT_SHA),
CONSUL_VERSION: (function (val) {
if (val) {
return val;
}
@ -57,7 +64,7 @@ module.exports = function(environment, $ = process.env) {
const contents = fs.readFileSync(version_go).toString();
return contents
.split('\n')
.find(function(item, i, arr) {
.find(function (item, i, arr) {
return item.indexOf('Version =') !== -1;
})
.trim()

Loading…
Cancel
Save