-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathbefore_install.sh
More file actions
executable file
·115 lines (90 loc) · 3.57 KB
/
Copy pathbefore_install.sh
File metadata and controls
executable file
·115 lines (90 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/env bash
# WARNING: DO NOT EDIT!
#
# This file was generated by plugin_template, and is managed by it. Please use
# './plugin-template --github pulp_python' to update this file.
#
# For more info visit https://github.com/pulp/plugin_template
# make sure this script runs at the repo root
cd "$(dirname "$(realpath -e "$0")")"/../../..
set -mveuo pipefail
if [ "${GITHUB_REF##refs/heads/}" = "${GITHUB_REF}" ]
then
BRANCH_BUILD=0
else
BRANCH_BUILD=1
BRANCH="${GITHUB_REF##refs/heads/}"
fi
if [ "${GITHUB_REF##refs/tags/}" = "${GITHUB_REF}" ]
then
TAG_BUILD=0
else
TAG_BUILD=1
BRANCH="${GITHUB_REF##refs/tags/}"
fi
if [[ "$TEST" == "plugin-from-pypi" ]]; then
COMPONENT_VERSION=$(http https://pypi.org/pypi/pulp-python/json | jq -r '.info.version')
else
COMPONENT_VERSION=$(sed -ne "s/\s*version=['\"]\(.*\)['\"][\s,]*/\1/p" setup.py)
fi
mkdir .ci/ansible/vars || true
echo "---" > .ci/ansible/vars/main.yaml
echo "component_name: pulp_python" >> .ci/ansible/vars/main.yaml
echo "component_version: '${COMPONENT_VERSION}'" >> .ci/ansible/vars/main.yaml
export PRE_BEFORE_INSTALL=$PWD/.github/workflows/scripts/pre_before_install.sh
export POST_BEFORE_INSTALL=$PWD/.github/workflows/scripts/post_before_install.sh
COMMIT_MSG=$(git log --format=%B --no-merges -1)
export COMMIT_MSG
if [ -f $PRE_BEFORE_INSTALL ]; then
source $PRE_BEFORE_INSTALL
fi
if [[ -n $(echo -e $COMMIT_MSG | grep -P "Required PR:.*" | grep -v "https") ]]; then
echo "Invalid Required PR link detected in commit message. Please use the full https url."
exit 1
fi
if [ "$GITHUB_EVENT_NAME" = "pull_request" ] || [ "${BRANCH_BUILD}" = "1" -a "${BRANCH}" != "master" ]
then
export PULPCORE_PR_NUMBER=$(echo $COMMIT_MSG | grep -oP 'Required\ PR:\ https\:\/\/github\.com\/pulp\/pulpcore\/pull\/(\d+)' | awk -F'/' '{print $7}')
export PULP_SMASH_PR_NUMBER=$(echo $COMMIT_MSG | grep -oP 'Required\ PR:\ https\:\/\/github\.com\/pulp\/pulp-smash\/pull\/(\d+)' | awk -F'/' '{print $7}')
export PULP_OPENAPI_GENERATOR_PR_NUMBER=$(echo $COMMIT_MSG | grep -oP 'Required\ PR:\ https\:\/\/github\.com\/pulp\/pulp-openapi-generator\/pull\/(\d+)' | awk -F'/' '{print $7}')
echo $COMMIT_MSG | sed -n -e 's/.*CI Base Image:\s*\([-_/[:alnum:]]*:[-_[:alnum:]]*\).*/ci_base: "\1"/p' >> .ci/ansible/vars/main.yaml
else
export PULPCORE_PR_NUMBER=
export PULP_SMASH_PR_NUMBER=
export PULP_OPENAPI_GENERATOR_PR_NUMBER=
export CI_BASE_IMAGE=
fi
cd ..
git clone --depth=1 https://github.com/pulp/pulp-openapi-generator.git
if [ -n "$PULP_OPENAPI_GENERATOR_PR_NUMBER" ]; then
cd pulp-openapi-generator
git fetch origin pull/$PULP_OPENAPI_GENERATOR_PR_NUMBER/head:$PULP_OPENAPI_GENERATOR_PR_NUMBER
git checkout $PULP_OPENAPI_GENERATOR_PR_NUMBER
cd ..
fi
cd pulp-openapi-generator
sed -i -e 's/localhost:24817/pulp/g' generate.sh
sed -i -e 's/:24817/pulp/g' generate.sh
cd ..
git clone --depth=1 https://github.com/pulp/pulpcore.git --branch master
cd pulpcore
if [ -n "$PULPCORE_PR_NUMBER" ]; then
git fetch --depth=1 origin pull/$PULPCORE_PR_NUMBER/head:$PULPCORE_PR_NUMBER
git checkout $PULPCORE_PR_NUMBER
fi
cd ..
git clone --depth=1 https://github.com/pulp/pulp-smash.git
if [ -n "$PULP_SMASH_PR_NUMBER" ]; then
cd pulp-smash
git fetch --depth=1 origin pull/$PULP_SMASH_PR_NUMBER/head:$PULP_SMASH_PR_NUMBER
git checkout $PULP_SMASH_PR_NUMBER
cd ..
fi
pip install --upgrade --force-reinstall ./pulp-smash
# Intall requirements for ansible playbooks
pip install docker netaddr boto3 ansible
ansible-galaxy collection install amazon.aws
cd pulp_python
if [ -f $POST_BEFORE_INSTALL ]; then
source $POST_BEFORE_INSTALL
fi