xref: /aosp_15_r20/external/grpc-grpc/tools/bazelify_tests/workspace_status_cmd.sh (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1#!/bin/bash
2# Copyright 2023 The gRPC 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
16set -e
17
18GRPC_GIT_COMMIT="$(git rev-parse HEAD)"
19echo "STABLE_GRPC_GIT_COMMIT ${GRPC_GIT_COMMIT}"
20
21# produce a value that has name and commit for every submodule
22echo -n 'STABLE_GRPC_SUBMODULE_ARCHIVES'
23git submodule --quiet foreach 'git_commit="$(git rev-parse HEAD)"; echo -n " ${name}/${git_commit}"'; echo ""
24
25# set info about whether the git workspace is clean/dirty and checksum of git patch
26if [ "$(git status --porcelain)" == "" ]
27then
28  echo "STABLE_GRPC_GIT_WORKSPACE_DIRTY false"
29else
30  echo "STABLE_GRPC_GIT_WORKSPACE_DIRTY true"
31  echo "STABLE_GRPC_UNCOMMITED_PATCH_CHECKSUM $(git diff HEAD | sha256sum | cut -f1 -d' ')"
32fi
33
34# Since only --workspace_status_command is allowed by bazel, also include
35# status from the "default" workspace status command.
36tools/remote_build/workspace_status_kokoro.sh
37