ci(backport-1.8): publish static assets (#9166)

* ci:add check for bindata_assetfs changes (#8712)

Co-authored-by: John Cowen <jcowen@hashicorp.com>
Co-authored-by: hashicorp-ci <hashicorp-ci@users.noreply.github.com>

* Merge pull request #8776 from hashicorp/ci/fix-auto-bindata

commit a new bindata file if there are changes

* add git config for static assets (#8777)

* add commit sha to static-asset auto commit

* ci: fix bindata autoupdate (#8801)

* update bindata on ui-v2/ changes

* ci: publish bindata_assetfs.go for all release/.x branches (#9158)

Co-authored-by: Alvin Huang <17609145+alvin-huang@users.noreply.github.com>
Co-authored-by: John Cowen <jcowen@hashicorp.com>
Co-authored-by: hashicorp-ci <hashicorp-ci@users.noreply.github.com>
Co-authored-by: Daniel Nephin <dnephin@hashicorp.com>
This commit is contained in:
Mike Morris 2020-11-16 14:40:51 -05:00 committed by GitHub
parent 7df79f0988
commit 6138ed20f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 7 deletions

View File

@ -548,6 +548,36 @@ jobs:
paths:
- ./agent/bindata_assetfs.go
# commits static assets to git
publish-static-assets:
docker:
- image: *GOLANG_IMAGE
steps:
- checkout
- add_ssh_keys: # needs a key to push updated static asset commit back to github
fingerprints:
- "c9:04:b7:85:bf:0e:ce:93:5f:b8:0e:68:8e:16:f3:71"
- attach_workspace:
at: .
- run:
name: commit agent/bindata_assetfs.go if there are UI changes
command: |
# 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"
short_sha=$(git rev-parse --short HEAD)
git add agent/bindata_assetfs.go
git commit -m "auto-updated agent/bindata_assetfs.go from commit ${short_sha}"
git push origin master
else
echo "no UI changes so no static assets to publish"
fi
- run: *notify-slack-failure
# run ember frontend tests
ember-test-oss:
docker:
@ -717,7 +747,6 @@ workflows:
- go-test-api:
requires: [dev-build]
- go-test-sdk: *filter-ignore-non-go-branches
build-distros:
jobs:
- check-vendor: *filter-ignore-non-go-branches
@ -739,6 +768,14 @@ workflows:
- build-static-assets:
requires:
- ember-build-prod
- publish-static-assets:
filters:
branches:
only:
- master
- /release\/\d+\.\d+\.x$/
requires:
- build-static-assets
- dev-build:
requires:
- build-static-assets
@ -782,7 +819,6 @@ workflows:
- envoy-integration-test-1.14.5:
requires:
- dev-build
website:
jobs:
- build-website-docker-image:

View File

@ -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,
@ -34,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;
}
@ -45,7 +45,7 @@ module.exports = function(environment, $ = process.env) {
.split('-')
.shift();
})(process.env.CONSUL_COPYRIGHT_YEAR),
CONSUL_GIT_SHA: (function(val) {
CONSUL_GIT_SHA: (function (val) {
if (val) {
return val;
}
@ -55,7 +55,7 @@ module.exports = function(environment, $ = process.env) {
.toString()
.trim();
})(process.env.CONSUL_GIT_SHA),
CONSUL_VERSION: (function(val) {
CONSUL_VERSION: (function (val) {
if (val) {
return val;
}
@ -64,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()