aboutsummaryrefslogtreecommitdiffstats
path: root/.cirrus.yml
blob: 38f10d42e5bbb87320f3fd98425ff21344f7641c (plain) (blame)
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
---

# Main environment vars to set for all tasks
env:

    FEDORA_VER: "34"
    FEDORA_PRIOR_VER: "33"
    FEDORA_NAME: "fedora-${FEDORA_VER}"
    FEDORA_PRIOR_NAME: "fedora-${FEDORA_PRIOR_VER}"

    UBUNTU_NAME: "ubuntu-20.04"
    UBUNTU_PRIOR_NAME: "ubuntu-18.04"

    CENTOS_NAME: "centos-stream-8"

    CENTOS_PROJECT: "centos-cloud"
    SOS_PROJECT: "sos-devel-jobs"
    UBUNTU_PROJECT: "ubuntu-os-cloud"

    # These are generated images pushed to GCP from Red Hat
    FEDORA_IMAGE_NAME: "f${FEDORA_VER}-server-sos-testing"
    FEDORA_PRIOR_IMAGE_NAME: "f${FEDORA_PRIOR_VER}-server-sos-testing"
    FOREMAN_CENTOS_IMAGE_NAME: "foreman-25-centos-8-sos-testing"
    FOREMAN_DEBIAN_IMAGE_NAME: "foreman-25-debian-10-sos-testing"

    # Images exist on GCP already
    CENTOS_IMAGE_NAME: "centos-stream-8-v20210609"
    UBUNTU_IMAGE_NAME: "ubuntu-2004-focal-v20201111"
    UBUNTU_PRIOR_IMAGE_NAME: "ubuntu-1804-bionic-v20201111"

# Default task timeout
timeout_in: 30m

# enable auto cancelling concurrent builds on main when multiple PRs are
# merged at once
auto_cancellation: true

gcp_credentials: ENCRYPTED[!77d4c8251094346c41db63cb05eba2ff98eaff04e58c5d0e2a8e2c6f159f7d601b3fe9a2a4fce1666297e371f2fc8752!]

# Run a simple lint on the community cluster
flake8_task:
    alias: "flake8_test"
    name: "Flake8 linting test"
    container:
        image: alpine/flake8:latest
    flake_script: flake8 sos

# nose tests, again on the community cluster
nosetests_task:
    alias: nosetests
    name: "Nosetests"
    container:
        image: python:slim
    setup_script: pip install nose
    nose_script: nosetests -v --with-cover --cover-package=sos tests/unittests

# Run a check on newer upstream python versions to check for possible
# breaks/changes in common modules. This is not meant to check any of the actual
# collections or archive integrity.
py_break_task:
    alias: "py_break"
    name: "Breakage test python-$PY_VERSION"
    container:
        image: "python:${PY_VERSION}"
    matrix:
        - env:
            PY_VERSION: "latest"
        - env:
            PY_VERSION: "3.9"
    setup_script: pip install -r requirements.txt
    main_script: ./bin/sos report --batch

# Make sure a user can manually build an rpm from the checkout
rpm_build_task:
    alias: "rpm_build"
    name: "RPM Build From Checkout"
    container:
        image: "fedora"
    setup_script: dnf -y install rpm-build rpmdevtools gettext python3-devel
    main_script: |
        rpmdev-setuptree
        python3 setup.py sdist
        cp dist/sos*.tar.gz ~/rpmbuild/SOURCES
        rpmbuild -bs sos.spec
        rpmbuild -bb sos.spec

# Run the stage one (no mocking) tests across all distros on GCP
report_stageone_task:
    alias: "stageone_report"
    name: "Report Stage One - $BUILD_NAME"
    gce_instance: &standardvm
        image_project: "${PROJECT}"
        image_name: "${VM_IMAGE_NAME}"
        type: e2-medium
    matrix:
        - env:
            PROJECT: ${CENTOS_PROJECT}
            BUILD_NAME: ${CENTOS_NAME}
            VM_IMAGE_NAME: ${CENTOS_IMAGE_NAME}
        - env:
            PROJECT: ${SOS_PROJECT}
            BUILD_NAME: ${FEDORA_NAME}
            VM_IMAGE_NAME: ${FEDORA_IMAGE_NAME}
        - env:
            PROJECT: ${SOS_PROJECT}
            BUILD_NAME: ${FEDORA_PRIOR_NAME}
            VM_IMAGE_NAME: ${FEDORA_PRIOR_IMAGE_NAME}
        - env:
            PROJECT: ${UBUNTU_PROJECT}
            BUILD_NAME: ${UBUNTU_NAME}
            VM_IMAGE_NAME: ${UBUNTU_IMAGE_NAME}
        - env:
            PROJECT: ${UBUNTU_PROJECT}
            BUILD_NAME: ${UBUNTU_PRIOR_NAME}
            VM_IMAGE_NAME: ${UBUNTU_PRIOR_IMAGE_NAME}
    remove_sos_script: &remove_sos |
        if [ $(command -v apt) ]; then
            apt -y purge sosreport
            apt update --allow-releaseinfo-change
            apt -y install python3-pip
        fi
        if [ $(command -v dnf) ]; then
            dnf -y remove sos
        fi
    setup_script: &setup 'pip3 install avocado-framework'
    main_script: PYTHONPATH=tests/ avocado run -t stageone tests/{cleaner,collect,report,vendor}_tests

# IFF the stage one tests all pass, then run stage two for latest distros
report_stagetwo_task:
    alias: "stagetwo_report"
    name: "Report Stage Two - $BUILD_NAME"
    depends_on: stageone_report
    gce_instance: *standardvm
    matrix:
        - env:
            PROJECT: ${CENTOS_PROJECT}
            BUILD_NAME: ${CENTOS_NAME}
            VM_IMAGE_NAME: ${CENTOS_IMAGE_NAME}
        - env:
            PROJECT: ${SOS_PROJECT}
            BUILD_NAME: ${FEDORA_NAME}
            VM_IMAGE_NAME: ${FEDORA_IMAGE_NAME}
        - env:
            PROJECT: ${UBUNTU_PROJECT}
            BUILD_NAME: ${UBUNTU_NAME}
            VM_IMAGE_NAME: ${UBUNTU_IMAGE_NAME}
    remove_sos_script: *remove_sos
    install_pexpect_script: |
        if [ $(command -v apt) ]; then
            apt -y install python3-pexpect
        fi
        if [ $(command -v dnf) ]; then
            dnf -y install python3-pexpect
        fi
    setup_script: *setup
    main_script: PYTHONPATH=tests/ avocado run -t stagetwo tests/{cleaner,collect,report,vendor}_tests

report_foreman_task:
    skip: "!changesInclude('.cirrus.yml', '**/{__init__,apache,foreman,foreman_tests,candlepin,pulp,pulpcore}.py')"
    alias: "foreman_integration"
    name: "Integration Test - Foreman ${FOREMAN_VER}"
    depends_on: stageone_report
    gce_instance: &bigvm
        <<: *standardvm
        type: e2-standard-2
    matrix:
        - env:
            PROJECT: ${SOS_PROJECT}
            VM_IMAGE_NAME: ${FOREMAN_CENTOS_IMAGE_NAME}
            FOREMAN_VER: "2.5 - CentOS Stream 8"
        - env:
            PROJECT: ${SOS_PROJECT}
            VM_IMAGE_NAME: ${FOREMAN_DEBIAN_IMAGE_NAME}
            FOREMAN_VER: "2.5 - Debian 10"
    remove_sos_script: *remove_sos
    setup_script: *setup
    main_script: PYTHONPATH=tests/ avocado run -t foreman tests/product_tests/foreman/