forked from pulp/pulp_python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·125 lines (107 loc) · 3.76 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·125 lines (107 loc) · 3.76 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
116
117
118
119
120
121
122
123
124
125
#!/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")")"/../../..
REPO_ROOT="$PWD"
set -euv
source .github/workflows/scripts/utils.sh
if [[ "$TEST" = "docs" || "$TEST" = "publish" ]]; then
pip install -r ../pulpcore/doc_requirements.txt
pip install -r doc_requirements.txt
fi
pip install -r functest_requirements.txt
cd .ci/ansible/
TAG=ci_build
if [[ "$TEST" == "plugin-from-pypi" ]]; then
PLUGIN_NAME=pulp_python
elif [[ "${RELEASE_WORKFLOW:-false}" == "true" ]]; then
PLUGIN_NAME=./pulp_python/dist/pulp_python-$PLUGIN_VERSION-py3-none-any.whl
else
PLUGIN_NAME=./pulp_python
fi
if [[ "${RELEASE_WORKFLOW:-false}" == "true" ]]; then
# Install the plugin only and use published PyPI packages for the rest
# Quoting ${TAG} ensures Ansible casts the tag as a string.
cat >> vars/main.yaml << VARSYAML
image:
name: pulp
tag: "${TAG}"
plugins:
- name: pulpcore
source: pulpcore
- name: pulp_python
source: "${PLUGIN_NAME}"
services:
- name: pulp
image: "pulp:${TAG}"
volumes:
- ./settings:/etc/pulp
VARSYAML
else
cat >> vars/main.yaml << VARSYAML
image:
name: pulp
tag: "${TAG}"
plugins:
- name: pulp_python
source: "${PLUGIN_NAME}"
- name: pulpcore
source: ./pulpcore
services:
- name: pulp
image: "pulp:${TAG}"
volumes:
- ./settings:/etc/pulp
VARSYAML
fi
cat >> vars/main.yaml << VARSYAML
pulp_settings: {"orphan_protection_time": 0}
pulp_scheme: https
pulp_container_tag: https
VARSYAML
if [ "$TEST" = "s3" ]; then
export MINIO_ACCESS_KEY=AKIAIT2Z5TDYPX3ARJBA
export MINIO_SECRET_KEY=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
sed -i -e '/^services:/a \
- name: minio\
image: minio/minio\
env:\
MINIO_ACCESS_KEY: "'$MINIO_ACCESS_KEY'"\
MINIO_SECRET_KEY: "'$MINIO_SECRET_KEY'"\
command: "server /data"' vars/main.yaml
sed -i -e '$a s3_test: true\
minio_access_key: "'$MINIO_ACCESS_KEY'"\
minio_secret_key: "'$MINIO_SECRET_KEY'"' vars/main.yaml
fi
ansible-playbook build_container.yaml
ansible-playbook start_container.yaml
echo ::group::SSL
# Copy pulp CA
sudo docker cp pulp:/etc/pulp/certs/pulp_webserver.crt /usr/local/share/ca-certificates/pulp_webserver.crt
# Hack: adding pulp CA to certifi.where()
CERTIFI=$(python -c 'import certifi; print(certifi.where())')
cat /usr/local/share/ca-certificates/pulp_webserver.crt | sudo tee -a $CERTIFI
if [ "$TEST" = "azure" ]; then
cat /usr/local/share/ca-certificates/azcert.crt | sudo tee -a $CERTIFI
fi
# Hack: adding pulp CA to default CA file
CERT=$(python -c 'import ssl; print(ssl.get_default_verify_paths().openssl_cafile)')
cat $CERTIFI | sudo tee -a $CERT
# Updating certs
sudo update-ca-certificates
echo ::endgroup::
if [ "$TEST" = "azure" ]; then
cat /usr/local/share/ca-certificates/azcert.crt >> /opt/az/lib/python3.6/site-packages/certifi/cacert.pem
cat /usr/local/share/ca-certificates/azcert.crt | docker exec -i pulp bash -c "cat >> /usr/local/lib/python3.8/site-packages/certifi/cacert.pem"
cat /usr/local/share/ca-certificates/azcert.crt | docker exec -i pulp bash -c "cat >> /etc/pki/tls/cert.pem"
AZURE_STORAGE_CONNECTION_STRING='DefaultEndpointsProtocol=https;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=https://pulp-azurite:10000/devstoreaccount1;'
az storage container create --name pulp-test --connection-string $AZURE_STORAGE_CONNECTION_STRING
fi
echo ::group::PIP_LIST
cmd_prefix bash -c "pip3 list && pip3 install pipdeptree && pipdeptree"
echo ::endgroup::