Skip to content

Commit c55b90d

Browse files
authored
Merge pull request #274 from gerrod3/travisconf
Updating Travis config
2 parents 810e0ce + dbe0649 commit c55b90d

24 files changed

Lines changed: 605 additions & 253 deletions

.travis.yml

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# WARNING: DO NOT EDIT!
22
#
3-
# This file was generated by plugin_template, and is managed by bootstrap.py. Please use
4-
# bootstrap.py to update this file.
3+
# This file was generated by plugin_template, and is managed by it. Please use
4+
# './plugin-template --travis pulp_python' to update this file.
55
#
66
# For more info visit https://github.com/pulp/plugin_template
77
---
88
sudo: required
99
# https://docs.travis-ci.com/user/trusty-ci-environment/
10-
dist: xenial
10+
dist: bionic
1111
language: python
1212
python:
1313
# Fedora has 3.6 available (python36.x86_64), but pulp container images
@@ -18,11 +18,6 @@ env:
1818
matrix:
1919
- TEST=pulp
2020
- TEST=docs
21-
matrix:
22-
exclude:
23-
- python: '3.6'
24-
env: TEST=docs
25-
fast_finish: true
2621
services:
2722
- postgresql
2823
- redis-server
@@ -39,38 +34,39 @@ install: .travis/install.sh
3934
before_script: .travis/before_script.sh
4035
script: .travis/script.sh
4136
after_failure:
42-
- http --timeout 30 --check-status --pretty format --print hb http://localhost:24817/pulp/api/v3/status/
43-
- sudo docker images
44-
- sudo kubectl logs -l name=pulp-operator -c ansible --tail=10000
45-
- sudo kubectl logs -l name=pulp-operator -c operator --tail=10000
46-
- sudo kubectl logs -l app=pulp-api --tail=50000
47-
- sudo kubectl logs -l app=pulp-content --tail=10000
48-
- sudo kubectl logs -l app=pulp-resource-manager --tail=10000
49-
- sudo kubectl logs -l app=pulp-worker --tail=10000
37+
- http --timeout 30 --check-status --pretty format --print hb http://pulp/pulp/api/v3/status/
38+
- docker images
39+
- docker ps -a
40+
- docker logs pulp
5041
jobs:
5142
include:
52-
- stage: deploy-plugin-to-pypi
43+
- stage: deploy
44+
name: "Deploy plugin to pypi"
5345
before_install: skip
5446
install: skip
5547
before_script: skip
5648
script: bash .travis/publish_plugin_pypi.sh
5749
if: tag IS present
58-
- stage: publish-daily-client-gem
50+
- stage: deploy
51+
name: "Publish client to rubygems"
5952
script: bash .travis/publish_client_gem.sh
6053
env:
6154
- TEST=bindings
6255
if: type = cron
63-
- stage: publish-daily-client-pypi
56+
- stage: deploy
57+
name: "Publish client to pypi"
6458
script: bash .travis/publish_client_pypi.sh
6559
env:
6660
- TEST=bindings
6761
if: type = cron
68-
- stage: publish-client-gem
62+
- stage: deploy
63+
name: "Publish client to rubygems"
6964
script: bash .travis/publish_client_gem.sh
7065
env:
7166
- TEST=bindings
7267
if: tag IS present
73-
- stage: publish-client-pypi
68+
- stage: deploy
69+
name: "Publish client to pypi"
7470
script: bash .travis/publish_client_pypi.sh
7571
env:
7672
- TEST=bindings

.travis/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Containerfile
2+
settings/
3+
vars/

.travis/Containerfile.j2

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM pulp/pulp-ci:latest
2+
3+
{% if s3_test | default(false) %}
4+
# Hacking botocore (https://github.com/boto/botocore/pull/1990)
5+
RUN pip3 install django-storages[boto3]
6+
RUN pip3 install git+https://github.com/fabricio-aguiar/botocore.git@fix-100-continue
7+
{% endif %}
8+
9+
{% for item in plugins %}
10+
11+
# Install {{ item.name }} from {{ item.source }}
12+
{% if item.name == "pulp-certguard" %}
13+
RUN pip3 install python-dateutil rhsm
14+
{% endif %}
15+
{% if item.source.startswith("./") %}
16+
ADD {{ item.source }} {{ item.source }}
17+
{% endif %}
18+
RUN pip3 install {{ item.source }}
19+
RUN mkdir -p /etc/nginx/pulp/
20+
RUN ln /usr/local/lib/python3.7/site-packages/{{ item.name }}/app/webserver_snippets/nginx.conf /etc/nginx/pulp/{{ item.name }}.conf || true
21+
{% endfor %}
22+
23+
ENTRYPOINT ["/init"]

.travis/ansible.cfg

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[defaults]
2+
inventory = inventory.yaml
3+
filter_plugins = filter
4+
retry_files_enabled = False
5+
transport = local
6+
nocows = 1
7+
stdout_callback = yaml

.travis/before_install.sh

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
# WARNING: DO NOT EDIT!
44
#
5-
# This file was generated by plugin_template, and is managed by bootstrap.py. Please use
6-
# bootstrap.py to update this file.
5+
# This file was generated by plugin_template, and is managed by it. Please use
6+
# './plugin-template --travis pulp_python' to update this file.
77
#
88
# For more info visit https://github.com/pulp/plugin_template
99

@@ -16,27 +16,23 @@ COMMIT_MSG=$(git log --format=%B --no-merges -1)
1616
export COMMIT_MSG
1717

1818
if [ -f $PRE_BEFORE_INSTALL ]; then
19-
$PRE_BEFORE_INSTALL
19+
source $PRE_BEFORE_INSTALL
2020
fi
2121

2222
if [[ -n $(echo -e $COMMIT_MSG | grep -P "Required PR:.*" | grep -v "https") ]]; then
2323
echo "Invalid Required PR link detected in commit message. Please use the full https url."
2424
exit 1
2525
fi
2626

27-
if [ "$TRAVIS_PULL_REQUEST" != "false" ] || [ -z "$TRAVIS_TAG" -a "$TRAVIS_BRANCH" != "master"]
27+
if [ "$TRAVIS_PULL_REQUEST" != "false" ] || [ -z "$TRAVIS_TAG" -a "$TRAVIS_BRANCH" != "master" ]
2828
then
29-
export PULP_PR_NUMBER=$(echo $COMMIT_MSG | grep -oP 'Required\ PR:\ https\:\/\/github\.com\/pulp\/pulpcore\/pull\/(\d+)' | awk -F'/' '{print $7}')
30-
export PULP_SMASH_PR_NUMBER=$(echo $COMMIT_MSG | grep -oP 'Required\ PR:\ https\:\/\/github\.com\/PulpQE\/pulp-smash\/pull\/(\d+)' | awk -F'/' '{print $7}')
31-
export PULP_ROLES_PR_NUMBER=$(echo $COMMIT_MSG | grep -oP 'Required\ PR:\ https\:\/\/github\.com\/pulp\/ansible-pulp\/pull\/(\d+)' | awk -F'/' '{print $7}')
32-
export PULP_BINDINGS_PR_NUMBER=$(echo $COMMIT_MSG | grep -oP 'Required\ PR:\ https\:\/\/github\.com\/pulp\/pulp-openapi-generator\/pull\/(\d+)' | awk -F'/' '{print $7}')
33-
export PULP_OPERATOR_PR_NUMBER=$(echo $COMMIT_MSG | grep -oP 'Required\ PR:\ https\:\/\/github\.com\/pulp\/pulp-operator\/pull\/(\d+)' | awk -F'/' '{print $7}')
29+
export PULPCORE_PR_NUMBER=$(echo $COMMIT_MSG | grep -oP 'Required\ PR:\ https\:\/\/github\.com\/pulp\/pulpcore\/pull\/(\d+)' | awk -F'/' '{print $7}')
30+
export PULP_SMASH_PR_NUMBER=$(echo $COMMIT_MSG | grep -oP 'Required\ PR:\ https\:\/\/github\.com\/pulp\/pulp-smash\/pull\/(\d+)' | awk -F'/' '{print $7}')
31+
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}')
3432
else
35-
export PULP_PR_NUMBER=
33+
export PULPCORE_PR_NUMBER=
3634
export PULP_SMASH_PR_NUMBER=
37-
export PULP_ROLES_PR_NUMBER=
38-
export PULP_BINDINGS_PR_NUMBER=
39-
export PULP_OPERATOR_PR_NUMBER=
35+
export PULP_OPENAPI_GENERATOR_PR_NUMBER=
4036
fi
4137

4238
# dev_requirements contains tools needed for flake8, etc.
@@ -51,50 +47,45 @@ pip install -r dev_requirements.txt
5147
# Lint code.
5248
flake8 --config flake8.cfg
5349

54-
cd ..
55-
git clone --depth=1 https://github.com/pulp/ansible-pulp.git
56-
if [ -n "$PULP_ROLES_PR_NUMBER" ]; then
57-
cd ansible-pulp
58-
git fetch --depth=1 origin +refs/pull/$PULP_ROLES_PR_NUMBER/merge
59-
git checkout FETCH_HEAD
60-
cd ..
61-
fi
50+
# check for imports from pulpcore that aren't pulpcore.plugin
51+
./.travis/check_pulpcore_imports.sh
6252

53+
cd ..
6354

64-
git clone --depth=1 https://github.com/pulp/pulp-operator.git
65-
if [ -n "$PULP_OPERATOR_PR_NUMBER" ]; then
66-
cd pulp-operator
67-
git fetch --depth=1 origin +refs/pull/$PULP_OPERATOR_PR_NUMBER/merge
68-
git checkout FETCH_HEAD
69-
RELEASE_VERSION=v0.9.0
70-
curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
71-
chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu && sudo mkdir -p /usr/local/bin/ && sudo cp operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu /usr/local/bin/operator-sdk && rm operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
72-
sudo operator-sdk build --image-builder=docker quay.io/pulp/pulp-operator:latest
55+
git clone https://github.com/pulp/pulp-openapi-generator.git
56+
if [ -n "$PULP_OPENAPI_GENERATOR_PR_NUMBER" ]; then
57+
cd pulp-openapi-generator
58+
git fetch origin pull/$PULP_OPENAPI_GENERATOR_PR_NUMBER/head:$PULP_OPENAPI_GENERATOR_PR_NUMBER
59+
git checkout $PULP_OPENAPI_GENERATOR_PR_NUMBER
7360
cd ..
7461
fi
7562

63+
cd pulp-openapi-generator
64+
sed -i -e 's/localhost:24817/pulp/g' generate.sh
65+
sed -i -e 's/:24817/pulp/g' generate.sh
66+
cd ..
7667

77-
git clone --depth=1 https://github.com/pulp/pulpcore.git
68+
git clone --depth=1 https://github.com/pulp/pulpcore.git --branch master
7869

79-
if [ -n "$PULP_PR_NUMBER" ]; then
80-
cd pulpcore
81-
git fetch --depth=1 origin +refs/pull/$PULP_PR_NUMBER/merge
82-
git checkout FETCH_HEAD
83-
cd ..
70+
cd pulpcore
71+
if [ -n "$PULPCORE_PR_NUMBER" ]; then
72+
git fetch --depth=1 origin pull/$PULPCORE_PR_NUMBER/head:$PULPCORE_PR_NUMBER
73+
git checkout $PULPCORE_PR_NUMBER
8474
fi
75+
cd ..
8576

8677

8778

8879
# When building a (release) tag, we don't need the development modules for the
8980
# build (they will be installed as dependencies of the plugin).
9081
if [ -z "$TRAVIS_TAG" ]; then
9182

92-
git clone --depth=1 https://github.com/PulpQE/pulp-smash.git
83+
git clone --depth=1 https://github.com/pulp/pulp-smash.git
9384

9485
if [ -n "$PULP_SMASH_PR_NUMBER" ]; then
9586
cd pulp-smash
96-
git fetch --depth=1 origin +refs/pull/$PULP_SMASH_PR_NUMBER/merge
97-
git checkout FETCH_HEAD
87+
git fetch --depth=1 origin pull/$PULP_SMASH_PR_NUMBER/head:$PULP_SMASH_PR_NUMBER
88+
git checkout $PULP_SMASH_PR_NUMBER
9889
cd ..
9990
fi
10091

@@ -104,10 +95,17 @@ if [ -z "$TRAVIS_TAG" ]; then
10495
fi
10596

10697

107-
pip install ansible
98+
# Intall requirements for ansible playbooks
99+
pip install docker netaddr boto3
100+
101+
# Install ansible with the boto3 tags to dict fix
102+
# There is a PR for this issue:
103+
# https://github.com/ansible-collections/amazon.aws/pull/37
104+
# Be aware, that the code will have moved to that collection with upcoming releases of ansible
105+
pip install git+https://github.com/mdellweg/ansible.git@fix_boto3_tags_dict
108106

109107
cd pulp_python
110108

111109
if [ -f $POST_BEFORE_INSTALL ]; then
112-
$POST_BEFORE_INSTALL
110+
source $POST_BEFORE_INSTALL
113111
fi

.travis/before_script.sh

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,31 @@
22

33
# WARNING: DO NOT EDIT!
44
#
5-
# This file was generated by plugin_template, and is managed by bootstrap.py. Please use
6-
# bootstrap.py to update this file.
5+
# This file was generated by plugin_template, and is managed by it. Please use
6+
# './plugin-template --travis pulp_python' to update this file.
77
#
88
# For more info visit https://github.com/pulp/plugin_template
99

1010
set -euv
1111

12+
source .travis/utils.sh
13+
1214
export PRE_BEFORE_SCRIPT=$TRAVIS_BUILD_DIR/.travis/pre_before_script.sh
1315
export POST_BEFORE_SCRIPT=$TRAVIS_BUILD_DIR/.travis/post_before_script.sh
1416

15-
# Aliases for running commands in the pulp-api container.
16-
export PULP_API_POD=$(sudo kubectl get pods | grep -E -o "pulp-api-(\w+)-(\w+)")
17-
# Run a command
18-
export CMD_PREFIX="sudo kubectl exec $PULP_API_POD --"
19-
# Run a command, and pass STDIN
20-
export CMD_STDIN_PREFIX="sudo kubectl exec -i $PULP_API_POD --"
21-
2217
if [[ -f $PRE_BEFORE_SCRIPT ]]; then
23-
$PRE_BEFORE_SCRIPT
18+
source $PRE_BEFORE_SCRIPT
2419
fi
2520

26-
mkdir -p ~/.config/pulp_smash
27-
28-
if [[ -f .travis/pulp-smash-config.json ]]; then
29-
sed "s/localhost/$(hostname)/g" .travis/pulp-smash-config.json > ~/.config/pulp_smash/settings.json
30-
else
31-
sed "s/localhost/$(hostname)/g" ../pulpcore/.travis/pulp-smash-config.json > ~/.config/pulp_smash/settings.json
32-
fi
21+
# Developers often want to know the final pulp config
22+
echo "PULP CONFIG:"
23+
tail -v -n +1 .travis/settings/settings.* ~/.config/pulp_smash/settings.json
3324

34-
if [[ "$TEST" == 'pulp' || "$TEST" == 'performance' ]]; then
35-
# Many tests require pytest/mock, but users do not need them at runtime
36-
# (or to add plugins on top of pulpcore or pulp container images.)
37-
# So install it here, rather than in the image Dockerfile.
38-
$CMD_PREFIX pip3 install pytest mock
39-
# Many functional tests require these
40-
$CMD_PREFIX dnf install -yq lsof which dnf-plugins-core
25+
if [[ "$TEST" == 'pulp' || "$TEST" == 'performance' || "$TEST" == 's3' ]]; then
26+
# Many functional tests require these
27+
cmd_prefix dnf install -yq lsof which dnf-plugins-core
4128
fi
4229

4330
if [[ -f $POST_BEFORE_SCRIPT ]]; then
44-
$POST_BEFORE_SCRIPT
31+
source $POST_BEFORE_SCRIPT
4532
fi

.travis/build_container.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Ansible playbook to create the pulp service containers image
2+
---
3+
- hosts: localhost
4+
gather_facts: false
5+
vars_files:
6+
- vars/main.yaml
7+
tasks:
8+
- name: "Generate Containerfile from template"
9+
template:
10+
src: Containerfile.j2
11+
dest: Containerfile
12+
13+
- name: "Build pulp image"
14+
docker_image:
15+
# We build from the ../.. (parent dir of pulpcore git repo) Docker build
16+
# "context" so that repos like pulp-smash are accessible to Docker
17+
# build. So that PR branches can be used via relative paths.
18+
#
19+
# We default to using the docker build / podman buildah cache, for
20+
# 1-off-builds and Travis CI purposes (which has no cache across CI runs.)
21+
# Run build.yaml with -e cache=false if your builds are using outdated
22+
# layers.
23+
name: "{{ image.name }}"
24+
tag: "{{ image.tag }}"
25+
build:
26+
path: "../.."
27+
dockerfile: "{{ playbook_dir }}/Containerfile"
28+
nocache: "{{ not cache | default(true) | bool }}"
29+
pull: false
30+
state: present
31+
source: build
32+
33+
- name: "Clean image cache"
34+
docker_prune:
35+
images : true
36+
...

.travis/check_commit.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
# WARNING: DO NOT EDIT!
44
#
5-
# This file was generated by plugin_template, and is managed by bootstrap.py. Please use
6-
# bootstrap.py to update this file.
5+
# This file was generated by plugin_template, and is managed by it. Please use
6+
# './plugin-template --travis pulp_python' to update this file.
77
#
88
# For more info visit https://github.com/pulp/plugin_template
99

.travis/check_pulpcore_imports.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# WARNING: DO NOT EDIT!
4+
#
5+
# This file was generated by plugin_template, and is managed by it. Please use
6+
# './plugin-template --travis pulp_python' to update this file.
7+
#
8+
# For more info visit https://github.com/pulp/plugin_template
9+
10+
set -uv
11+
12+
# check for imports not from pulpcore.plugin. exclude tests
13+
MATCHES=$(grep -n -r --include \*.py "from pulpcore.*import" . | grep -v "tests\|plugin")
14+
15+
if [ $? -ne 1 ]; then
16+
printf "\nERROR: Detected bad imports from pulpcore:\n"
17+
echo "$MATCHES"
18+
printf "\nPlugins should import from pulpcore.plugin."
19+
exit 1
20+
fi

0 commit comments

Comments
 (0)