Merge pull request #329 from dod-ccpo/fix-github-link-in-buildinfo
Fix link to github repo in buildinfo.json
This commit is contained in:
commit
98eb7bab96
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# script/generate_build_info: Generates buildinfo.html and buildinfo.json and
|
# script/generate_build_info: Generates buildinfo.html and buildinfo.json and
|
||||||
# places them in a publically accessable static asset
|
# places them in a publicly accessable static asset
|
||||||
# folder
|
# folder
|
||||||
|
|
||||||
source "$(dirname "${0}")"/../script/include/global_header.inc.sh
|
source "$(dirname "${0}")"/../script/include/global_header.inc.sh
|
||||||
@ -36,15 +36,20 @@ echo "Gathering info from git..."
|
|||||||
COMMIT_AUTHOR=$(git log -1 --pretty=%aN)
|
COMMIT_AUTHOR=$(git log -1 --pretty=%aN)
|
||||||
COMMIT_AUTHOR_EMAIL=$(git log -1 --pretty=%aE)
|
COMMIT_AUTHOR_EMAIL=$(git log -1 --pretty=%aE)
|
||||||
GIT_SHA=$(git rev-parse HEAD)
|
GIT_SHA=$(git rev-parse HEAD)
|
||||||
# Escape all double quotes in commit message and switch newlines for \n
|
# Escape all double quotes in commit message and switch newlines for \n
|
||||||
# (for JSON compatability)
|
# (for JSON compatability)
|
||||||
COMMIT_MESSAGE_JSON=$(git log -1 --pretty=format:%B | sed -e 's#\([^\\]\)"#\1\\"#g' | awk 1 ORS='\\n')
|
COMMIT_MESSAGE_JSON=$(git log -1 --pretty=format:%B | sed -e 's#\([^\\]\)"#\1\\"#g' | awk 1 ORS='\\n')
|
||||||
# Escape all < and > characters in commit message and trade newlines for <BR/> tags
|
# Escape all < and > characters in commit message and trade newlines for <BR/> tags
|
||||||
COMMIT_MESSAGE_HTML=$(git log -1 --pretty=format:%B | sed -e 's#>#>#g' | sed -e 's#<#<#g' | awk 1 ORS='<BR/>')
|
COMMIT_MESSAGE_HTML=$(git log -1 --pretty=format:%B | sed -e 's#>#>#g' | sed -e 's#<#<#g' | awk 1 ORS='<BR/>')
|
||||||
|
|
||||||
# Assemble https based git repo url
|
# Assemble https based git repo url
|
||||||
GIT_REPO=$(git config --get remote.origin.url | cut -d ':' -f 2)
|
GIT_REMOTE_URL=$(git config --get remote.origin.url)
|
||||||
GIT_URL="https://github.com/${GIT_REPO}"
|
if [[ ${GIT_REMOTE_URL} =~ "@" ]]
|
||||||
|
then
|
||||||
|
GIT_URL="https://github.com/$(echo "${GIT_REMOTE_URL}" | cut -d ':' -f 2)"
|
||||||
|
else
|
||||||
|
GIT_URL="${GIT_REMOTE_URL}"
|
||||||
|
fi
|
||||||
# Drop the trailing .git for generating github links
|
# Drop the trailing .git for generating github links
|
||||||
GITHUB_BASE_URL="${GIT_URL%.git}"
|
GITHUB_BASE_URL="${GIT_URL%.git}"
|
||||||
GITHUB_COMMIT_URL="${GITHUB_BASE_URL}/commit/${GIT_SHA}"
|
GITHUB_COMMIT_URL="${GITHUB_BASE_URL}/commit/${GIT_SHA}"
|
||||||
@ -52,7 +57,7 @@ GITHUB_COMMIT_URL="${GITHUB_BASE_URL}/commit/${GIT_SHA}"
|
|||||||
APP_CONTAINER_CREATE_DATE=$(date '+%Y-%m-%d')
|
APP_CONTAINER_CREATE_DATE=$(date '+%Y-%m-%d')
|
||||||
APP_CONTAINER_CREATE_TIME=$(date '+%H:%M:%S')
|
APP_CONTAINER_CREATE_TIME=$(date '+%H:%M:%S')
|
||||||
|
|
||||||
echo "Generating public/buildinfo.json ..."
|
echo "Generating ${STATIC_DIR}/buildinfo.json ..."
|
||||||
cat > ${STATIC_DIR}/buildinfo.json <<ENDJSON
|
cat > ${STATIC_DIR}/buildinfo.json <<ENDJSON
|
||||||
{
|
{
|
||||||
"build_info" : {
|
"build_info" : {
|
||||||
@ -81,7 +86,7 @@ cat > ${STATIC_DIR}/buildinfo.json <<ENDJSON
|
|||||||
}
|
}
|
||||||
ENDJSON
|
ENDJSON
|
||||||
|
|
||||||
echo "Generating public/buildinfo.html ..."
|
echo "Generating ${STATIC_DIR}/buildinfo.html ..."
|
||||||
cat > ${STATIC_DIR}/buildinfo.html <<ENDHTML
|
cat > ${STATIC_DIR}/buildinfo.html <<ENDHTML
|
||||||
<HTML>
|
<HTML>
|
||||||
<HEAD>
|
<HEAD>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user