-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathbefore_install.sh
More file actions
executable file
·127 lines (113 loc) · 5.17 KB
/
before_install.sh
File metadata and controls
executable file
·127 lines (113 loc) · 5.17 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
#!/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] git+https://github.com/gerrod3/botocore.git@fix-100-continue"
fi
if [ "$TEST" = "azure" ]; then
COMPONENT_SOURCE="${COMPONENT_SOURCE} pulpcore[azure,uvloop]"
fi
if [[ "$TEST" = "pulp" ]]; then
python3 .ci/scripts/calc_constraints.py -u pyproject.toml > upperbounds_constraints.txt
fi
if [[ "$TEST" = "lowerbounds" ]]; then
python3 .ci/scripts/calc_constraints.py pyproject.toml > lowerbounds_constraints.txt
fi
# Compose the scenario definition.
mkdir -p .ci/ansible/vars
cat > .ci/ansible/vars/main.yaml << VARSYAML
---
scenario: "${TEST}"
plugin_name: "pulp_python"
legacy_component_name: "pulp_python"
component_name: "python"
component_version: "${COMPONENT_VERSION}"
pulp_env: {}
pulp_settings: {"allowed_export_paths": "/tmp", "allowed_import_paths": "/tmp", "api_root": "/pulp/", "orphan_protection_time": 0, "pypi_api_hostname": "https://pulp:443"}
pulp_scheme: "https"
image:
name: "pulp"
tag: "ci_build"
ci_base: "ghcr.io/pulp/pulp-ci-centos9:latest"
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)
lowerbounds: $(test "${TEST}" = "lowerbounds" && echo -n true || echo -n false)
webserver_snippet: $(test -f pulp_python/app/webserver_snippets/nginx.conf && echo -n true || echo -n false )
extra_files:
- origin: "pulp_python"
destination: "pulp_python"
services:
- name: "pulp"
image: "pulp:ci_build"
volumes:
- "./settings:/etc/pulp"
- "../../../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"}}, "api_root": "/rerouted/djnd/", "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"}}, "content_origin": null}
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