github.com/astaxie/beego@v1.12.3/scripts/report_build_info.sh (about)

     1  #!/bin/bash
     2  
     3  # WARNING: DO NOT EDIT, THIS FILE IS PROBABLY A COPY
     4  #
     5  # The original version of this file is located in the https://github.com/istio/common-files repo.
     6  # If you're looking at this file in a different repo and want to make a change, please go to the
     7  # common-files repo, make the change there and check it in. Then come back to this repo and run
     8  # "make update-common".
     9  
    10  # Copyright Istio Authors
    11  #
    12  #   Licensed under the Apache License, Version 2.0 (the "License");
    13  #   you may not use this file except in compliance with the License.
    14  #   You may obtain a copy of the License at
    15  #
    16  #       http://www.apache.org/licenses/LICENSE-2.0
    17  #
    18  #   Unless required by applicable law or agreed to in writing, software
    19  #   distributed under the License is distributed on an "AS IS" BASIS,
    20  #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    21  #   See the License for the specific language governing permissions and
    22  #   limitations under the License.
    23  
    24  # adapt to beego
    25  
    26  if BUILD_GIT_REVISION=$(git rev-parse HEAD 2> /dev/null); then
    27    if [[ -n "$(git status --porcelain 2>/dev/null)" ]]; then
    28      BUILD_GIT_REVISION=${BUILD_GIT_REVISION}"-dirty"
    29    fi
    30  else
    31    BUILD_GIT_REVISION=unknown
    32  fi
    33  
    34  # Check for local changes
    35  if git diff-index --quiet HEAD --; then
    36    tree_status="Clean"
    37  else
    38    tree_status="Modified"
    39  fi
    40  
    41  # security wanted VERSION='unknown'
    42  VERSION="${BUILD_GIT_REVISION}"
    43  if [[ -n ${BEEGO_VERSION} ]]; then
    44    VERSION="${BEEGO_VERSION}"
    45  fi
    46  
    47  GIT_DESCRIBE_TAG=$(git describe --tags)
    48  
    49  echo "github.com/astaxie/beego.BuildVersion=${VERSION}"
    50  echo "github.com/astaxie/beego.BuildGitRevision=${BUILD_GIT_REVISION}"
    51  echo "github.com/astaxie/beego.BuildStatus=${tree_status}"
    52  echo "github.com/astaxie/beego.BuildTag=${GIT_DESCRIBE_TAG}"