Add stable/2402 branch and remove stable/2306 branch to docker executor image scripts
[ci-management.git] / docker / scripts / dbld_lfit_requirements.sh
1 #! /bin/bash
2
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:
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
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.
15
16 set -euxo pipefail
17
18 export CIMAN_DOCKER_SCRIPTS=${CIMAN_DOCKER_SCRIPTS:-"$(dirname $BASH_SOURCE)"}
19 . "$CIMAN_DOCKER_SCRIPTS/lib_common.sh"
20
21 must_be_run_in_docker_build
22
23 # Add packagecloud files
24 cat <<EOF >/root/.packagecloud
25 {"url":"https://packagecloud.io","token":"\$token"}
26 EOF
27 cat <<EOF >/root/packagecloud_api
28 machine packagecloud.io
29 login \$pclogin
30 password
31 EOF
32
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"
38
39 # When running in CI docker image, use the pre-installed venv
40 # instead of installing python packages every job run.
41 #
42 unset -f lf-activate-venv
43 lf-activate-venv() {
44     echo "\${FUNCNAME[0]}(): INFO: Adding $LF_VENV/bin to PATH"
45     PATH="\$LF_VENV/bin:\$PATH"
46     return 0
47 }
48 EOF
49
50 # Install lftools & boto3 for log / artifact upload.
51 python3 -m pip install boto3
52 mkdir -p "$LF_VENV"
53 OLD_PATH="$PATH"
54 python3 -m venv "$LF_VENV"
55 PATH="$LF_VENV/bin:$PATH"
56 python3 -m pip install pip --upgrade
57 python3 -m pip install --upgrade --upgrade-strategy eager lftools
58 PATH="$OLD_PATH"