3 # Copyright (c) 2021 Cisco and/or its affiliates.
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:
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
18 export CIMAN_DOCKER_SCRIPTS=${CIMAN_DOCKER_SCRIPTS:-"$(dirname $BASH_SOURCE)"}
19 . "$CIMAN_DOCKER_SCRIPTS/lib_common.sh"
21 must_be_run_in_docker_build
23 # Add packagecloud files
24 cat <<EOF >/root/.packagecloud
25 {"url":"https://packagecloud.io","token":"\$token"}
27 cat <<EOF >/root/packagecloud_api
28 machine packagecloud.io
33 # Copy lf-env.sh for LF Releng scripts
34 lf_env_sh="/root/lf-env.sh"
35 cp "$DOCKER_CIMAN_ROOT/global-jjb/jenkins-init-scripts/lf-env.sh" "$lf_env_sh"
36 chmod 644 "$lf_env_sh"
37 cat <<EOF >>"$lf_env_sh"
39 # When running in CI docker image, use the pre-installed venv
40 # instead of installing python packages every job run.
42 unset -f lf-activate-venv
44 echo "\${FUNCNAME[0]}(): INFO: Adding $LF_VENV/bin to PATH"
45 PATH="\$LF_VENV/bin:\$PATH"
50 # Install lftools & boto3 for log / artifact upload.
51 python3 -m pip install boto3
54 python3 -m venv "$LF_VENV"
55 PATH="$LF_VENV/bin:$PATH"
56 python3 -m pip install --upgrade pip==21.2.4
57 python3 -m pip install --upgrade --upgrade-strategy eager lftools