github.com/RedHatInsights/insights-content-service@v1.0.0/build.sh (about) 1 #!/bin/bash 2 # Copyright 2020 Red Hat, Inc 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 16 # this is improper - we need to start using tags in GitHub properly 17 18 set -exv 19 20 version=0.2 21 22 buildtime=$(date) 23 branch=$(git rev-parse --abbrev-ref HEAD) 24 commit=$(git rev-parse HEAD) 25 26 utils_version=$(go list -m github.com/RedHatInsights/insights-operator-utils | awk '{print $2}') 27 28 ocp_rules_version=$(grep "^CCX_RULES_OCP_TAG=\".*\"$" update_rules_content.sh | awk -F'CCX_RULES_OCP_TAG="|"' '{print $2}') 29 30 # Update ccx-rules-ocp 31 ./update_rules_content.sh "$@" 32 33 build_flags="-v" 34 35 case "$*" in 36 (*-cover*) build_flags="-v -cover";; 37 esac 38 39 go build ${build_flags} -ldflags="-X 'main.BuildTime=$buildtime' -X 'main.BuildVersion=$version' -X 'main.BuildBranch=$branch' -X 'main.BuildCommit=$commit' -X 'main.UtilsVersion=$utils_version' -X 'main.OCPRulesVersion=$ocp_rules_version'" 40 exit $?