Skip to content

Commit

Permalink
Merge pull request #87 from privacysandbox/release-0.61.1
Browse files Browse the repository at this point in the history
Release 0.61.1
  • Loading branch information
pmeric authored May 10, 2024
2 parents d9500b6 + c144442 commit 333094f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.

## 0.61.1 (2024-05-10)


### Bug Fixes

* Add docker flags to container name
* Set 8h ttl for long-running build container

## 0.61.0 (2024-05-08)


Expand Down
30 changes: 19 additions & 11 deletions tools/cbuild
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ declare -i WITH_CMD_PROFILER=0
DOCKER_NETWORK="${DOCKER_NETWORK:-bridge}"
declare -i DOCKER_SECCOMP_UNCONFINED=0
declare -i KEEP_CONTAINER_RUNNING=0
declare LONG_RUNNING_CONTAINER_TIMEOUT=8h

while [[ $# -gt 0 ]]; do
case "$1" in
Expand Down Expand Up @@ -138,12 +139,6 @@ if ! [[ " ${IMAGE_LIST[*]} " =~ " ${IMAGE} " ]]; then
usage 1
fi

function get_container_name() {
local -r mount="$(echo "${WORKSPACE_MOUNT}" | sha256sum)"
local -r image_sha="${IMAGE_TAGGED##*-}"
printf "cbuild-%s-%s" "${mount:0:7}" "${image_sha:0:7}"
}

TOOLS_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
readonly TOOLS_DIR
# shellcheck disable=SC1090
Expand Down Expand Up @@ -181,17 +176,13 @@ if [[ ${PWD_WORKSPACE_REL_PATH:0:1} != / ]]; then
fi
readonly WORKDIR

DOCKER_CONTAINER_NAME="$(get_container_name)"
readonly DOCKER_CONTAINER_NAME

# DOCKER_EXEC_RUN_ARGS applies to both `docker run` and `docker exec`
declare -a DOCKER_EXEC_RUN_ARGS=(
"--workdir=${WORKDIR}"
)
declare -a DOCKER_RUN_ARGS=(
"--rm"
"--entrypoint=/bin/bash"
"--name=${DOCKER_CONTAINER_NAME}"
"--volume=${WORKSPACE_MOUNT}:/src/workspace"
"--network=${DOCKER_NETWORK}"
"$(echo "${EXTRA_DOCKER_RUN_ARGS}" | envsubst)"
Expand Down Expand Up @@ -236,6 +227,23 @@ if [[ -t 0 ]] && [[ -t 1 ]]; then
)
fi

function get_container_name() {
local -r mount="$(echo "${WORKSPACE_MOUNT}" | sha256sum)"
local -r image_sha="${IMAGE_TAGGED##*-}"
local -r docker_args_sha="$({
cat <<EOF
${DOCKER_RUN_ARGS[*]}
${DOCKER_EXEC_RUN_ARGS[*]}
EOF
} | sha256sum)"
printf "cbuild-%s-%s-%s" "${mount:0:7}" "${image_sha:0:7}" "${docker_args_sha:0:7}"
}

DOCKER_CONTAINER_NAME="$(get_container_name)"
readonly DOCKER_CONTAINER_NAME

DOCKER_RUN_ARGS+=("--name=${DOCKER_CONTAINER_NAME}")

if [[ ${VERBOSE} -eq 1 ]]; then
set -o xtrace
fi
Expand Down Expand Up @@ -277,7 +285,7 @@ function long_running_container() {
--login -c "
declare -i -r pid=\$(bazel info server_pid 2>/dev/null)
# wait for pid, even if it's not a child process of this shell
tail --pid=\${pid} -f /dev/null
timeout ${LONG_RUNNING_CONTAINER_TIMEOUT} tail --pid=\${pid} -f /dev/null
" &>/dev/null
fi
fi
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.61.0
0.61.1

0 comments on commit 333094f

Please sign in to comment.