/
before_script.sh
executable file
·53 lines (41 loc) · 1.87 KB
/
before_script.sh
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
#!/usr/bin/env bash
# WARNING: DO NOT EDIT!
#
# This file was generated by plugin_template, and is managed by bootstrap.py. Please use
# bootstrap.py to update this file.
#
# For more info visit https://github.com/pulp/plugin_template
set -euv
export PRE_BEFORE_SCRIPT=$TRAVIS_BUILD_DIR/.travis/pre_before_script.sh
export POST_BEFORE_SCRIPT=$TRAVIS_BUILD_DIR/.travis/post_before_script.sh
# Aliases for running commands in the pulp-api container.
export PULP_API_POD=$(sudo kubectl get pods | grep -E -o "pulp-api-(\w+)-(\w+)")
# Run a command
export CMD_PREFIX="sudo kubectl exec $PULP_API_POD --"
# Run a command, and pass STDIN
export CMD_STDIN_PREFIX="sudo kubectl exec -i $PULP_API_POD --"
if [[ -f $PRE_BEFORE_SCRIPT ]]; then
$PRE_BEFORE_SCRIPT
fi
mkdir -p ~/.config/pulp_smash
if [[ -f .travis/pulp-smash-config.json ]]; then
sed "s/localhost/$(hostname)/g" .travis/pulp-smash-config.json > ~/.config/pulp_smash/settings.json
else
sed "s/localhost/$(hostname)/g" ../pulpcore/.travis/pulp-smash-config.json > ~/.config/pulp_smash/settings.json
fi
if [[ "$TEST" == 'pulp' || "$TEST" == 'performance' || "$TEST" == 's3' ]]; then
# Many tests require pytest/mock, but users do not need them at runtime
# (or to add plugins on top of pulpcore or pulp container images.)
# So install it here, rather than in the image Dockerfile.
$CMD_PREFIX pip3 install pytest mock
# Many functional tests require these
$CMD_PREFIX dnf install -yq lsof which dnf-plugins-core
# set up pulp-fixtures docker container
docker run -d -p 0.0.0.0:8000:80 quay.io/pulp/pulp-fixtures:latest
cat ~/.config/pulp_smash/settings.json | \
jq "setpath([\"custom\",\"fixtures_origin\"]; \"http://$(hostname):8000/fixtures/\")" > temp.json
cat temp.json > ~/.config/pulp_smash/settings.json
fi
if [[ -f $POST_BEFORE_SCRIPT ]]; then
$POST_BEFORE_SCRIPT
fi