...

Text file src/k8s.io/kubernetes/hack/print-workspace-status.sh

Documentation: k8s.io/kubernetes/hack

     1#!/usr/bin/env bash
     2# Copyright 2017 The Kubernetes Authors.
     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 script was used by bazel as the workspace_status_command to implement
    17# build stamping with git information.
    18#
    19# It is still useful for obtaining kube::version::get_version_vars without
    20# sourcing Kubernetes build internals.
    21#
    22# Usage: `hack/print-workspace-status.sh`.
    23
    24set -o errexit
    25set -o nounset
    26set -o pipefail
    27
    28KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
    29
    30source "${KUBE_ROOT}/hack/lib/version.sh"
    31kube::version::get_version_vars
    32
    33# Prefix with STABLE_ so that these values are saved to stable-status.txt
    34# instead of volatile-status.txt.
    35# Stamped rules will be retriggered by changes to stable-status.txt, but not by
    36# changes to volatile-status.txt.
    37# IMPORTANT: the camelCase vars should match the lists in hack/lib/version.sh
    38cat <<EOF
    39STABLE_BUILD_GIT_COMMIT ${KUBE_GIT_COMMIT-}
    40STABLE_BUILD_SCM_STATUS ${KUBE_GIT_TREE_STATE-}
    41STABLE_BUILD_SCM_REVISION ${KUBE_GIT_VERSION-}
    42STABLE_BUILD_MAJOR_VERSION ${KUBE_GIT_MAJOR-}
    43STABLE_BUILD_MINOR_VERSION ${KUBE_GIT_MINOR-}
    44STABLE_DOCKER_TAG ${KUBE_GIT_VERSION/+/_}
    45STABLE_DOCKER_REGISTRY ${KUBE_DOCKER_REGISTRY:-registry.k8s.io}
    46STABLE_DOCKER_PUSH_REGISTRY ${KUBE_DOCKER_PUSH_REGISTRY:-${KUBE_DOCKER_REGISTRY:-staging-k8s.gcr.io}}
    47gitCommit ${KUBE_GIT_COMMIT-}
    48gitTreeState ${KUBE_GIT_TREE_STATE-}
    49gitVersion ${KUBE_GIT_VERSION-}
    50gitMajor ${KUBE_GIT_MAJOR-}
    51gitMinor ${KUBE_GIT_MINOR-}
    52buildDate $(date \
    53  ${SOURCE_DATE_EPOCH:+"--date=@${SOURCE_DATE_EPOCH}"} \
    54 -u +'%Y-%m-%dT%H:%M:%SZ')
    55EOF

View as plain text