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
22 must_be_run_in_docker_build
24 # Add packagecloud files
25 cat <<EOF > /root/.packagecloud
26 {"url":"https://packagecloud.io","token":"\$token"}
28 cat <<EOF >/root/packagecloud_api
29 machine packagecloud.io
34 # Copy lf-env.sh for LF Releng scripts
35 lf_env_sh="/root/lf-env.sh"
36 cp $DOCKER_CIMAN_ROOT/global-jjb/jenkins-init-scripts/lf-env.sh $lf_env_sh
37 chmod 644 "$lf_env_sh"
38 cat <<EOF >>"$lf_env_sh"
40 # When running in CI docker image, use the pre-installed venv
41 # instead of installing python packages every job run.
43 unset -f lf-activate-venv
45 echo "\${FUNCNAME[0]}(): INFO: Adding $LF_VENV/bin to PATH"
46 PATH="$LF_VENV/bin:$PATH"
51 # Install lftools & boto3 for log / artifact upload.
52 python3 -m pip install boto3
55 python3 -m venv $LF_VENV
56 PATH="$LF_VENV/bin:$PATH"
57 python3 -m pip install --upgrade pip
58 python3 -m pip install --upgrade --upgrade-strategy eager lftools