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:
patricksmithdds 2018-09-25 13:18:36 -04:00 committed by GitHub
commit 98eb7bab96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
@ -43,8 +43,13 @@ COMMIT_MESSAGE_JSON=$(git log -1 --pretty=format:%B | sed -e 's#\([^\\]\)"#\1\\"
COMMIT_MESSAGE_HTML=$(git log -1 --pretty=format:%B | sed -e 's#>#&gt;#g' | sed -e 's#<#&lt;#g' | awk 1 ORS='<BR/>') COMMIT_MESSAGE_HTML=$(git log -1 --pretty=format:%B | sed -e 's#>#&gt;#g' | sed -e 's#<#&lt;#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>