Repository: envoyproxy/envoy
File: ci/do_ci.sh (Shell)

Code before:
    dockerhub-publish)
        setup_clang_toolchain
        bazel run "${BAZEL_BUILD_OPTIONS[@]}" \
              //tools/distribution:update_dockerhub_repository
        ;;

    dockerhub-readme)
        setup_clang_toolchain
        bazel build "${BAZEL_BUILD_OPTIONS[@]}" \
              --remote_download_toplevel \
              //distribution/dockerhub:readme
        cat bazel-bin/distribution/dockerhub/readme.md
        ;;

    docs)
        setup_clang_toolchain
        echo "generating docs..."
        # Build docs.
        [[ -z "${DOCS_OUTPUT_DIR}" ]] && DOCS_OUTPUT_DIR=generated/docs
        # We use a portable realpath alternative here since macOS realpath
        # does not support -m.
        if [[ -d "$DOCS_OUTPUT_DIR" ]]; then
          DOCS_OUTPUT_DIR="$(cd "$DOCS_OUTPUT_DIR" && pwd)"
        elif [[ "$DOCS_OUTPUT_DIR" != /* ]]; then
          DOCS_OUTPUT_DIR="${PWD}/${DOCS_OUTPUT_DIR}"
        fi
        rm -rf "${DOCS_OUTPUT_DIR:?}"/*
        mkdir -p "${DOCS_OUTPUT_DIR}"
        if [[ -e repo.bazelrc ]]; then
            cp -a repo.bazelrc "${ENVOY_DOCS_PATH}"
        fi
        pushd "$ENVOY_DOCS_PATH"
        if [[ -n "${CI_TARGET_BRANCH}" ]] || [[ -n "${SPHINX_QUIET}" ]]; then
            export SPHINX_RUNNER_ARGS="-v warn"
            BAZEL_BUILD_OPTIONS+=("--action_env=SPHINX_RUNNER_ARGS")
        fi
        if [[ -n "${DOCS_BUILD_RST}" ]]; then
            bazel "${BAZEL_STARTUP_OPTIONS[@]}" build "${BAZEL_BUILD_OPTIONS[@]}" //:rst
            cp bazel-bin/docs/rst.tar.gz "$DOCS_OUTPUT_DIR"/envoy-docs-rst.tar.gz
            exit 0
        fi
        bazel "${BAZEL_STARTUP_OPTIONS[@]}" run \
              "${BAZEL_BUILD_OPTIONS[@]}" \
              --@envoy//tools/tarball:target=//:html \
              @envoy//tools/tarball:unpack \
              "$DOCS_OUTPUT_DIR"
        popd
        ;;

    external)
        setup_clang_toolchain

Review comment (suggestion):
```suggestion
        if [[ -d "$DOCS_OUTPUT_DIR" ]]; then
            DOCS_OUTPUT_DIR="$(cd "$DOCS_OUTPUT_DIR" && pwd)"
        elif [[ "$DOCS_OUTPUT_DIR" != /* ]]; then
            DOCS_OUTPUT_DIR="${PWD}/${DOCS_OUTPUT_DIR}"
        fi
```

Code after:
            export DOCKER_LOAD_IMAGES=1
        fi
        echo "BUILDING FOR: ${PLATFORMS}"
        "${ENVOY_SRCDIR}/distribution/docker/build.sh"
        ;;

    dockerhub-publish)
        setup_clang_toolchain
        bazel run "${BAZEL_BUILD_OPTIONS[@]}" \
              //tools/distribution:update_dockerhub_repository
        ;;

    dockerhub-readme)
        setup_clang_toolchain
        bazel build "${BAZEL_BUILD_OPTIONS[@]}" \
              --remote_download_toplevel \
              //distribution/dockerhub:readme
        cat bazel-bin/distribution/dockerhub/readme.md
        ;;

    docs)
        setup_clang_toolchain
        echo "generating docs..."
        # Build docs.
        [[ -z "${DOCS_OUTPUT_DIR}" ]] && DOCS_OUTPUT_DIR=generated/docs
        DOCS_OUTPUT_DIR="$(_realpath "$DOCS_OUTPUT_DIR")"
        rm -rf "${DOCS_OUTPUT_DIR:?}"/*
        mkdir -p "${DOCS_OUTPUT_DIR}"
        if [[ -e repo.bazelrc ]]; then
            cp -a repo.bazelrc "${ENVOY_DOCS_PATH}"
        fi
        pushd "$ENVOY_DOCS_PATH"
        if [[ -n "${CI_TARGET_BRANCH}" ]] || [[ -n "${SPHINX_QUIET}" ]]; then
            export SPHINX_RUNNER_ARGS="-v warn"
            BAZEL_BUILD_OPTIONS+=("--action_env=SPHINX_RUNNER_ARGS")
        fi
        if [[ -n "${DOCS_BUILD_RST}" ]]; then
            bazel "${BAZEL_STARTUP_OPTIONS[@]}" build "${BAZEL_BUILD_OPTIONS[@]}" //:rst
            cp bazel-bin/docs/rst.tar.gz "$DOCS_OUTPUT_DIR"/envoy-docs-rst.tar.gz
            exit 0
        fi
        bazel "${BAZEL_STARTUP_OPTIONS[@]}" run \
              "${BAZEL_BUILD_OPTIONS[@]}" \
              --@envoy//tools/tarball:target=//:html \
              @envoy//tools/tarball:unpack \
              "$DOCS_OUTPUT_DIR"
        popd
        ;;

    external)
        setup_clang_toolchain