Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 40 additions & 6 deletions tools/build-identifier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,49 @@ if [[ -n ${RELEASE_TEST_BUILD_ID:-} ]] ; then
exit 0
fi

if [[ "$PWD" =~ "operator" ]] && [[ -n ${KOKORO_GIT_COMMIT_connector_operator:-} ]] ; then
echo -n "${KOKORO_GIT_COMMIT_connector_operator}"
exit 0
elif [[ "$PWD" =~ "proxy" ]] && [[ -n ${KOKORO_GIT_COMMIT_connector_proxy:-} ]] ; then
echo -n "${KOKORO_GIT_COMMIT_connector_proxy}"
exit 0
elif [[ "$PWD" =~ "go" ]] && [[ -n ${KOKORO_GIT_COMMIT_connector_go:-} ]] ; then
echo -n "${KOKORO_GIT_COMMIT_connector_go}"
exit 0
elif [[ "$PWD" =~ "python" ]] && [[ -n ${KOKORO_GIT_COMMIT_connector_python:-} ]] ; then
echo -n "${KOKORO_GIT_COMMIT_connector_python}"
exit 0
elif [[ "$PWD" =~ "node" ]] && [[ -n ${KOKORO_GIT_COMMIT_connector_nodejs:-} ]] ; then
echo -n "${KOKORO_GIT_COMMIT_connector_nodejs}"
exit 0
elif [[ "$PWD" =~ "java" ]] && [[ -n ${KOKORO_GIT_COMMIT_connector_java:-} ]] ; then
echo -n "${KOKORO_GIT_COMMIT_connector_java}"
exit 0
elif [[ -n ${KOKORO_GIT_COMMIT_gemini_connector_tools:-} ]] ; then
echo -n "${KOKORO_GIT_COMMIT_gemini_connector_tools}"
exit 0
elif [[ -n ${KOKORO_GIT_COMMIT:-} ]] ; then
echo -n "${KOKORO_GIT_COMMIT}"
exit 0
fi

NOW=$(date -u "+%Y%m%dT%H%M" | tr -d "\n")
GIT_HEAD=$( git rev-parse HEAD | tr -d "\n")

if git diff HEAD --exit-code --quiet ; then
# git working dir is clean.
IMAGE_VERSION="$GIT_HEAD"
if jj root >/dev/null 2>&1; then
JJ_COMMIT=$(jj log -r @ -T "commit_id" --no-graph | tr -d "\n")
if jj status | grep -q "Working copy changes:"; then
IMAGE_VERSION="$JJ_COMMIT-dirty-${NOW}"
else
IMAGE_VERSION="$JJ_COMMIT"
fi
else
# git working dir is dirty, append "dirty" and the timestamp
IMAGE_VERSION="$GIT_HEAD-dirty-${NOW}"
git config --global --add safe.directory "$PWD" 2>/dev/null || true
GIT_HEAD=$( git rev-parse HEAD | tr -d "\n" )
if git diff HEAD --exit-code --quiet ; then
IMAGE_VERSION="$GIT_HEAD"
else
IMAGE_VERSION="$GIT_HEAD-dirty-${NOW}"
fi
fi

echo -n "$IMAGE_VERSION"
2 changes: 1 addition & 1 deletion tools/docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -eio pipefail
set -eo pipefail
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

##
Expand Down
6 changes: 5 additions & 1 deletion tools/e2e_test_job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ mkdir -p bin

echo "Using installed gcloud"
gcloud version
gcloud components install --quiet gke-gcloud-auth-plugin
if ! which gke-gcloud-auth-plugin >/dev/null 2>&1 ; then
gcloud components install --quiet gke-gcloud-auth-plugin
else
echo "gke-gcloud-auth-plugin already installed"
fi

# Install helm
if ! which helm ; then
Expand Down
Loading