ci: fix bindata autoupdate (#8801)

* update bindata on ui-v2/ changes

* Revert "Remove GIT_SHA environment variable"

This reverts commit f620f9aefd41362ce76c3a8e0f4addf402ee0ca2.

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

This reverts commit 5ae493d79b34ef2143d78a44c21a63623140bba8.

* revert modtime change in #8712
This commit is contained in:
Alvin Huang 2020-10-02 15:23:38 -04:00 committed by GitHub
parent 526d005d72
commit 8b409529aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 12 deletions

View File

@ -641,10 +641,12 @@ jobs:
- attach_workspace: - attach_workspace:
at: . at: .
- run: - 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: | command: |
exit 0 # check if there are any changes in ui-v2/
if ! git diff --exit-code agent/uiserver/bindata_assetfs.go; then # 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.email "hashicorp-ci@users.noreply.github.com"
git config --local user.name "hashicorp-ci" 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 commit -m "auto-updated agent/uiserver/bindata_assetfs.go from commit ${short_sha}"
git push origin master git push origin master
else else
echo "no new static assets to publish" echo "no UI changes so no static assets to publish"
fi fi
- run: *notify-slack-failure - run: *notify-slack-failure

View File

@ -306,7 +306,7 @@ lint:
# also run as part of the release build script when it verifies that there are no # 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. # changes to the UI assets that aren't checked in.
static-assets: 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) @go fmt $(ASSETFS_PATH)

View File

@ -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> <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> <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> <a data-test-footer-docs href="{{env 'CONSUL_DOCS_URL'}}" rel="help noopener noreferrer" target="_blank">Documentation</a>
{{{concat '<!-- ' (env 'CONSUL_GIT_SHA') '-->'}}}
</footer> </footer>

View File

@ -11,9 +11,6 @@ module.exports = function(environment, $ = process.env) {
// torii provider. We provide this object here to // torii provider. We provide this object here to
// prevent ember from giving a log message when starting ember up // prevent ember from giving a log message when starting ember up
torii: {}, torii: {},
'ember-cli-app-version': {
version: 'consul-ui',
},
EmberENV: { EmberENV: {
FEATURES: { FEATURES: {
// Here you can enable experimental features on an ember canary build // Here you can enable experimental features on an ember canary build
@ -48,6 +45,16 @@ module.exports = function(environment, $ = process.env) {
.split('-') .split('-')
.shift(); .shift();
})(process.env.CONSUL_COPYRIGHT_YEAR), })(process.env.CONSUL_COPYRIGHT_YEAR),
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) { CONSUL_VERSION: (function (val) {
if (val) { if (val) {
return val; return val;