-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathbefore_install.sh
More file actions
executable file
·130 lines (115 loc) · 5.13 KB
/
before_install.sh
File metadata and controls
executable file
·130 lines (115 loc) · 5.13 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
126
127
128
129
130
#!/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
# This script prepares the scenario definition in the .ci/ansible/vars/main.yaml file.
#
# It requires the following environment:
# TEST - The name of the scenario to prepare.
#
# It may also dump the {lower,upper}bounds_constraints.txt for the specific scenario.
set -eu -o pipefail
# make sure this script runs at the repo root
cd "$(dirname "$(realpath -e "$0")")"/../../..
if [ -f .github/workflows/scripts/pre_before_install.sh ]; then
source .github/workflows/scripts/pre_before_install.sh
fi
COMPONENT_VERSION="$(bump-my-version show current_version | tail -n -1 | python -c 'from packaging.version import Version; print(Version(input()))')"
COMPONENT_SOURCE="./pulp_python/dist/pulp_python-${COMPONENT_VERSION}-py3-none-any.whl"
if [ "$TEST" = "s3" ]; then
COMPONENT_SOURCE="${COMPONENT_SOURCE} pulpcore[s3]"
fi
if [ "$TEST" = "azure" ]; then
COMPONENT_SOURCE="${COMPONENT_SOURCE} pulpcore[azure]"
fi
if [[ "$TEST" = "pulp" ]]; then
python3 .ci/scripts/calc_constraints.py -u requirements.txt > upperbounds_constraints.txt
fi
if [[ "$TEST" = "lowerbounds" ]]; then
python3 .ci/scripts/calc_constraints.py requirements.txt > lowerbounds_constraints.txt
fi
export PULP_API_ROOT=$(test "${TEST}" = "s3" && echo "/rerouted/djnd/" || echo "/pulp/")
echo "PULP_API_ROOT=${PULP_API_ROOT}" >> "$GITHUB_ENV"
# Compose the scenario definition.
mkdir -p .ci/ansible/vars
cat > .ci/ansible/vars/main.yaml << VARSYAML
---
scenario: "${TEST}"
legacy_component_name: "pulp_python"
component_name: "python"
component_version: "${COMPONENT_VERSION}"
pulp_env: {}
pulp_settings: {"allowed_export_paths": "/tmp", "allowed_import_paths": "/tmp", "orphan_protection_time": 0, "pypi_api_hostname": "https://pulp:443"}
pulp_scheme: "https"
pulp_default_container: "ghcr.io/pulp/pulp-ci-centos9:latest"
api_root: "${PULP_API_ROOT}"
image:
name: "pulp"
tag: "ci_build"
plugins:
- name: "pulp_python"
source: "${COMPONENT_SOURCE}"
ci_requirements: $(test -f ci_requirements.txt && echo -n true || echo -n false)
upperbounds: $(test "${TEST}" = "pulp" && echo -n true || echo -n false)
lowerounds: $(test "${TEST}" = "lowerbounds" && echo -n true || echo -n false)
services:
- name: "pulp"
image: "pulp:ci_build"
volumes:
- "./settings:/etc/pulp"
- "./ssh:/keys/"
- "~/.config:/var/lib/pulp/.config"
- "../../../pulp-openapi-generator:/root/pulp-openapi-generator"
env:
PULP_WORKERS: "4"
PULP_HTTPS: "true"
VARSYAML
if [ "$TEST" = "s3" ]; then
MINIO_ACCESS_KEY=AKIAIT2Z5TDYPX3ARJBA
MINIO_SECRET_KEY=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
cat >> .ci/ansible/vars/main.yaml << VARSYAML
- name: "minio"
image: "minio/minio"
env:
MINIO_ACCESS_KEY: "${MINIO_ACCESS_KEY}"
MINIO_SECRET_KEY: "${MINIO_SECRET_KEY}"
command: "server /data"
s3_test: true
minio_access_key: "${MINIO_ACCESS_KEY}"
minio_secret_key: "${MINIO_SECRET_KEY}"
pulp_scenario_settings: {"MEDIA_ROOT": "", "STORAGES": {"default": {"BACKEND": "storages.backends.s3boto3.S3Boto3Storage", "OPTIONS": {"access_key": "AKIAIT2Z5TDYPX3ARJBA", "addressing_style": "path", "bucket_name": "pulp3", "default_acl": "@none", "endpoint_url": "http://minio:9000", "region_name": "eu-central-1", "secret_key": "fqRvjWaPU5o0fCqQuUWbj9Fainj2pVZtBCiDiieS", "signature_version": "s3v4"}}, "staticfiles": {"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage"}}, "domain_enabled": true}
pulp_scenario_env: {}
VARSYAML
fi
if [ "$TEST" = "azure" ]; then
cat >> .ci/ansible/vars/main.yaml << VARSYAML
- name: "ci-azurite"
image: "mcr.microsoft.com/azure-storage/azurite"
command: "azurite-blob --skipApiVersionCheck --blobHost 0.0.0.0"
azure_test: true
pulp_scenario_settings: {"MEDIA_ROOT": "", "STORAGES": {"default": {"BACKEND": "storages.backends.azure_storage.AzureStorage", "OPTIONS": {"account_key": "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==", "account_name": "devstoreaccount1", "azure_container": "pulp-test", "connection_string": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://ci-azurite:10000/devstoreaccount1;", "expiration_secs": 120, "location": "pulp3", "overwrite_files": true}}, "staticfiles": {"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage"}}, "domain_enabled": true}
pulp_scenario_env: {}
VARSYAML
fi
if [ "$TEST" = "gcp" ]; then
cat >> .ci/ansible/vars/main.yaml << VARSYAML
- name: "ci-gcp"
image: "fsouza/fake-gcs-server"
volumes:
- "storage_data:/etc/pulp"
command: " -scheme http"
gcp_test: true
pulp_scenario_settings: null
pulp_scenario_env: {}
VARSYAML
fi
cat >> .ci/ansible/vars/main.yaml << VARSYAML
...
VARSYAML
cat .ci/ansible/vars/main.yaml
if [ -f .github/workflows/scripts/post_before_install.sh ]; then
source .github/workflows/scripts/post_before_install.sh
fi