diff options
author | ckl <ckl@google.com> | 2022-03-30 20:30:53 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-03-30 20:31:59 -0700 |
commit | c370cb7ff22444699ce75ee68da3f272f5ba05c0 (patch) | |
tree | 82e8959454c8fd26df814839e5e436c4299eaf35 | |
parent | 6d6b7a4d5d14ed44806527343f266f1a7a2cbe56 (diff) | |
download | tink-c370cb7ff22444699ce75ee68da3f272f5ba05c0.tar.gz |
Align cert update approach via a test utility script.
PiperOrigin-RevId: 438465207
-rw-r--r-- | kokoro/gcp_ubuntu_per_language/cc/cmake_openssl/run_tests.sh | 8 | ||||
-rw-r--r-- | kokoro/gcp_ubuntu_per_language/go/gomod/run_tests.sh | 5 | ||||
-rwxr-xr-x | kokoro/testutils/update_certs.sh | 33 |
3 files changed, 36 insertions, 10 deletions
diff --git a/kokoro/gcp_ubuntu_per_language/cc/cmake_openssl/run_tests.sh b/kokoro/gcp_ubuntu_per_language/cc/cmake_openssl/run_tests.sh index 7d0f154ba..5829252e6 100644 --- a/kokoro/gcp_ubuntu_per_language/cc/cmake_openssl/run_tests.sh +++ b/kokoro/gcp_ubuntu_per_language/cc/cmake_openssl/run_tests.sh @@ -90,12 +90,8 @@ main() { cd "${KOKORO_ARTIFACTS_DIR}/git/tink" ./kokoro/testutils/copy_credentials.sh - if [[ -n "${KOKORO_ROOT}" ]]; then - # TODO(b/201806781): Remove when no longer necessary. - sudo apt-get install -y ca-certificates - sudo rm -f /usr/share/ca-certificates/mozilla/DST_Root_CA_X3.crt - sudo update-ca-certificates - + ./kokoro/testutils/update_certs.sh + if [[ -n "${KOKORO_ROOT:-}" ]]; then install_cmake install_openssl fi diff --git a/kokoro/gcp_ubuntu_per_language/go/gomod/run_tests.sh b/kokoro/gcp_ubuntu_per_language/go/gomod/run_tests.sh index 8330de0b8..e4c1e3e0d 100644 --- a/kokoro/gcp_ubuntu_per_language/go/gomod/run_tests.sh +++ b/kokoro/gcp_ubuntu_per_language/go/gomod/run_tests.sh @@ -20,6 +20,7 @@ REPO_DIR="${KOKORO_ARTIFACTS_DIR}/git/tink" cd "${REPO_DIR}" ./kokoro/testutils/copy_credentials.sh +./kokoro/testutils/update_certs.sh # Sourcing required to update callers environment. source ./kokoro/testutils/install_go.sh @@ -33,10 +34,6 @@ GO_MOD_DIR="${TMP_DIR}/go-mod-test" REPO_URL_PREFIX="github.com/google/tink" -# TODO(b/201806781): Remove when no longer necessary. -sudo apt-get update -sudo apt-get upgrade -y ca-certificates - ####################################### # Test an individual Go module within the Tink repository. # Globals: diff --git a/kokoro/testutils/update_certs.sh b/kokoro/testutils/update_certs.sh new file mode 100755 index 000000000..ebcc35268 --- /dev/null +++ b/kokoro/testutils/update_certs.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +################################################################################ + +# This script updates SSL certificates in the Kokoro GCP Ubuntu environment. +# +# TODO(b/201806781): Remove when no longer necessary. +# +# Usage instructions: +# +# ./kokoro/testutils/update_certs.sh + +readonly PLATFORM="$(uname | tr '[:upper:]' '[:lower:]')" +if [[ -z "${KOKORO_ROOT}" || "${PLATFORM}" != "linux" ]]; then + exit 0 +fi + +sudo apt-get install -y ca-certificates +sudo rm -f /usr/share/ca-certificates/mozilla/DST_Root_CA_X3.crt +sudo update-ca-certificates |