| 1 | name: "ci" |
| 2 | on: |
| 3 | push: |
| 4 | branches: [master] |
| 5 | pull_request: |
| 6 | branches: [master] |
| 7 | concurrency: |
| 8 | group: ${{ github.workflow }}-${{ github.ref }} |
| 9 | cancel-in-progress: true |
| 10 | jobs: |
| 11 | system: |
| 12 | strategy: |
| 13 | fail-fast: false |
| 14 | matrix: |
| 15 | tag: |
| 16 | - rawhide |
| 17 | - fedora-latest |
| 18 | runs-on: ubuntu-latest |
| 19 | permissions: |
| 20 | contents: read |
| 21 | steps: |
| 22 | - uses: actions/setup-python@v5 |
| 23 | with: |
| 24 | python-version: 3.11 |
| 25 | |
| 26 | - name: Checkout repository |
| 27 | uses: actions/checkout@v4 |
| 28 | with: |
| 29 | path: authselect |
| 30 | |
| 31 | - name: Setup containers |
| 32 | uses: SSSD/sssd-ci-containers/actions/setup@master |
| 33 | with: |
| 34 | path: sssd-ci-containers |
| 35 | tag: ${{ matrix.tag }} |
| 36 | override: | |
| 37 | services: |
| 38 | client: |
| 39 | image: ${REGISTRY}/ci-client-devel:${TAG} |
| 40 | shm_size: 4G |
| 41 | tmpfs: |
| 42 | - /dev/shm |
| 43 | volumes: |
| 44 | - ../authselect:/authselect:rw |
| 45 | |
| 46 | - name: Install build dependencies on the client |
| 47 | uses: SSSD/sssd-ci-containers/actions/exec@master |
| 48 | with: |
| 49 | log-file: dependencies.log |
| 50 | working-directory: /authselect |
| 51 | user: root |
| 52 | where: client |
| 53 | script: | |
| 54 | #!/bin/bash |
| 55 | set -ex |
| 56 | |
| 57 | scripts/auto install-build-deps |
| 58 | |
| 59 | - name: Build authselect on the client |
| 60 | uses: SSSD/sssd-ci-containers/actions/exec@master |
| 61 | with: |
| 62 | log-file: build.log |
| 63 | working-directory: /authselect |
| 64 | where: client |
| 65 | script: | |
| 66 | #!/bin/bash |
| 67 | set -ex |
| 68 | |
| 69 | autoreconf -if && ./configure --enable-silent-rules |
| 70 | make rpms |
| 71 | |
| 72 | - name: Install authselect on the client |
| 73 | uses: SSSD/sssd-ci-containers/actions/exec@master |
| 74 | with: |
| 75 | log-file: install.log |
| 76 | working-directory: /authselect |
| 77 | user: root |
| 78 | where: client |
| 79 | script: | |
| 80 | #!/bin/bash |
| 81 | set -ex |
| 82 | |
| 83 | dnf install -y rpmbuild/RPMS/*/*.rpm |
| 84 | |
| 85 | - name: Install system tests dependencies |
| 86 | shell: bash |
| 87 | working-directory: ./authselect/src/tests/system |
| 88 | run: | |
| 89 | set -ex |
| 90 | |
| 91 | sudo apt-get update |
| 92 | |
| 93 | # Install dependencies for python-ldap |
| 94 | sudo apt-get install -y libsasl2-dev python3-dev libldap2-dev libssl-dev |
| 95 | |
| 96 | # Virtualenv |
| 97 | pip3 install virtualenv |
| 98 | python3 -m venv .venv |
| 99 | source .venv/bin/activate |
| 100 | |
| 101 | # Install system tests requirements |
| 102 | pip3 install -r ./requirements.txt |
| 103 | |
| 104 | - name: Check polarion metadata |
| 105 | shell: bash |
| 106 | working-directory: ./authselect/src/tests/system |
| 107 | run: | |
| 108 | # Run pytest in collect only mode to quickly catch issues in Polarion metadata. |
| 109 | set -ex -o pipefail |
| 110 | |
| 111 | mkdir -p $GITHUB_WORKSPACE/artifacts |
| 112 | source .venv/bin/activate |
| 113 | pytest \ |
| 114 | --color=yes \ |
| 115 | --mh-config=./mhc.yaml \ |
| 116 | --mh-artifacts-dir=$GITHUB_WORKSPACE/artifacts \ |
| 117 | --polarion-config=./polarion.yaml \ |
| 118 | --output-polarion-testcase=$GITHUB_WORKSPACE/artifacts/testcase.xml \ |
| 119 | --collect-only . |& tee $GITHUB_WORKSPACE/pytest-collect.log |
| 120 | |
| 121 | - name: Run tests |
| 122 | shell: bash |
| 123 | working-directory: ./authselect/src/tests/system |
| 124 | run: | |
| 125 | set -ex -o pipefail |
| 126 | |
| 127 | mkdir -p $GITHUB_WORKSPACE/artifacts |
| 128 | source .venv/bin/activate |
| 129 | pytest \ |
| 130 | --color=yes \ |
| 131 | --show-capture=no \ |
| 132 | --mh-config=./mhc.yaml \ |
| 133 | --mh-artifacts-dir=$GITHUB_WORKSPACE/artifacts \ |
| 134 | --polarion-config=./polarion.yaml \ |
| 135 | --output-polarion-testcase=$GITHUB_WORKSPACE/artifacts/testcase.xml \ |
| 136 | --output-polarion-testrun=$GITHUB_WORKSPACE/artifacts/testrun.xml \ |
| 137 | -vvv . |& tee $GITHUB_WORKSPACE/pytest.log |
| 138 | |
| 139 | - name: Upload artifacts |
| 140 | if: always() |
| 141 | uses: actions/upload-artifact@v4 |
| 142 | with: |
| 143 | if-no-files-found: ignore |
| 144 | name: ${{ matrix.tag }}-system |
| 145 | path: | |
| 146 | artifacts |
| 147 | dependencies.log |
| 148 | build.log |
| 149 | install.log |
| 150 | pytest.log |
| 151 | pytest-collect.log |
| 152 | |
| 153 | ostree: |
| 154 | runs-on: ubuntu-latest |
| 155 | permissions: |
| 156 | contents: read |
| 157 | steps: |
| 158 | - name: Checkout repository |
| 159 | uses: actions/checkout@v4 |
| 160 | with: |
| 161 | path: authselect |
| 162 | |
| 163 | - name: Setup containers |
| 164 | uses: SSSD/sssd-ci-containers/actions/setup@master |
| 165 | with: |
| 166 | path: sssd-ci-containers |
| 167 | tag: rawhide |
| 168 | override: | |
| 169 | services: |
| 170 | client: |
| 171 | image: ${REGISTRY}/ci-client-devel:${TAG} |
| 172 | shm_size: 4G |
| 173 | tmpfs: |
| 174 | - /dev/shm |
| 175 | volumes: |
| 176 | - ../authselect:/authselect:rw |
| 177 | |
| 178 | - name: Create ostree marker (mimic required ostree detection) |
| 179 | uses: SSSD/sssd-ci-containers/actions/exec@master |
| 180 | with: |
| 181 | user: root |
| 182 | where: client |
| 183 | script: | |
| 184 | #!/bin/bash |
| 185 | set -ex |
| 186 | mkdir -p /run |
| 187 | touch /run/ostree-booted |
| 188 | |
| 189 | - name: Install build dependencies on the client |
| 190 | uses: SSSD/sssd-ci-containers/actions/exec@master |
| 191 | with: |
| 192 | log-file: ostree-dependencies.log |
| 193 | working-directory: /authselect |
| 194 | user: root |
| 195 | where: client |
| 196 | script: | |
| 197 | #!/bin/bash |
| 198 | set -ex |
| 199 | |
| 200 | scripts/auto install-build-deps |
| 201 | |
| 202 | - name: Build authselect RPMs on the client |
| 203 | uses: SSSD/sssd-ci-containers/actions/exec@master |
| 204 | with: |
| 205 | log-file: ostree-build.log |
| 206 | working-directory: /authselect |
| 207 | where: client |
| 208 | script: | |
| 209 | #!/bin/bash |
| 210 | set -ex |
| 211 | autoreconf -if && ./configure --enable-silent-rules |
| 212 | make rpms |
| 213 | |
| 214 | - name: Install authselect RPMs on the client |
| 215 | uses: SSSD/sssd-ci-containers/actions/exec@master |
| 216 | with: |
| 217 | log-file: ostree-install.log |
| 218 | working-directory: /authselect |
| 219 | user: root |
| 220 | where: client |
| 221 | script: | |
| 222 | #!/bin/bash |
| 223 | set -ex |
| 224 | dnf install -y rpmbuild/RPMS/*/*.rpm |
| 225 | |
| 226 | - name: Verify that vendor profiles were created |
| 227 | uses: SSSD/sssd-ci-containers/actions/exec@master |
| 228 | with: |
| 229 | log-file: ostree-verify-vendor.log |
| 230 | user: root |
| 231 | where: client |
| 232 | script: | |
| 233 | #!/bin/bash |
| 234 | set -ex |
| 235 | |
| 236 | # Check that vendor profiles directory exists |
| 237 | test -d /usr/share/authselect/vendor |
| 238 | |
| 239 | # Check that vendor profiles were created for each default profile |
| 240 | for profile in sssd winbind local; do |
| 241 | if [ -d "/usr/share/authselect/default/$profile" ]; then |
| 242 | echo "Checking vendor profile: $profile" |
| 243 | test -d "/usr/share/authselect/vendor/$profile" || { |
| 244 | echo "ERROR: Vendor profile $profile not found" |
| 245 | exit 1 |
| 246 | } |
| 247 | |
| 248 | # Verify nsswitch.conf exists in vendor profile |
| 249 | nsswitch="/usr/share/authselect/vendor/$profile/nsswitch.conf" |
| 250 | test -f "$nsswitch" || { |
| 251 | echo "ERROR: nsswitch.conf not found in vendor/$profile" |
| 252 | exit 1 |
| 253 | } |
| 254 | |
| 255 | # Verify "with-altfiles" template conditional was removed |
| 256 | if grep -q "with-altfiles" "$nsswitch"; then |
| 257 | echo "ERROR: 'with-altfiles' template conditional still present in $nsswitch" |
| 258 | cat "$nsswitch" |
| 259 | exit 1 |
| 260 | fi |
| 261 | |
| 262 | echo "Vendor profile $profile: OK (with-altfiles conditional removed)" |
| 263 | fi |
| 264 | done |
| 265 | |
| 266 | - name: Verify altfiles is enabled in /etc/nsswitch.conf |
| 267 | uses: SSSD/sssd-ci-containers/actions/exec@master |
| 268 | with: |
| 269 | log-file: ostree-verify-altfiles.log |
| 270 | user: root |
| 271 | where: client |
| 272 | script: | |
| 273 | #!/bin/bash |
| 274 | set -ex |
| 275 | |
| 276 | echo "Checking /etc/nsswitch.conf for altfiles..." |
| 277 | cat /etc/nsswitch.conf |
| 278 | |
| 279 | # Check altfiles is present on passwd: line |
| 280 | if ! grep "^passwd:" /etc/nsswitch.conf | grep -q "altfiles"; then |
| 281 | echo "ERROR: 'altfiles' not found on passwd: line in /etc/nsswitch.conf" |
| 282 | exit 1 |
| 283 | fi |
| 284 | |
| 285 | # Check altfiles is present on group: line |
| 286 | if ! grep "^group:" /etc/nsswitch.conf | grep -q "altfiles"; then |
| 287 | echo "ERROR: 'altfiles' not found on group: line in /etc/nsswitch.conf" |
| 288 | exit 1 |
| 289 | fi |
| 290 | |
| 291 | echo "SUCCESS: altfiles present on passwd: and group: lines in /etc/nsswitch.conf" |
| 292 | |
| 293 | - name: Verify altfiles is enabled with with-group-merging /etc/nsswitch.conf |
| 294 | uses: SSSD/sssd-ci-containers/actions/exec@master |
| 295 | with: |
| 296 | log-file: ostree-verify-altfiles-after.log |
| 297 | user: root |
| 298 | where: client |
| 299 | script: | |
| 300 | #!/bin/bash |
| 301 | set -ex |
| 302 | |
| 303 | authselect enable-feature with-group-merging |
| 304 | |
| 305 | echo "Checking /etc/nsswitch.conf for altfiles after enabling with-group-merging..." |
| 306 | cat /etc/nsswitch.conf |
| 307 | |
| 308 | # Check altfiles is present on passwd: line |
| 309 | if ! grep "^passwd:" /etc/nsswitch.conf | grep -q "altfiles"; then |
| 310 | echo "ERROR: 'altfiles' not found on passwd: line in /etc/nsswitch.conf after feature change" |
| 311 | exit 1 |
| 312 | fi |
| 313 | |
| 314 | # Check altfiles is present on group: line |
| 315 | if ! grep "^group:" /etc/nsswitch.conf | grep -q "altfiles"; then |
| 316 | echo "ERROR: 'altfiles' not found on group: line in /etc/nsswitch.conf after feature change" |
| 317 | exit 1 |
| 318 | fi |
| 319 | |
| 320 | echo "SUCCESS: altfiles still present on passwd: and group: lines in /etc/nsswitch.conf after feature change" |
| 321 | |
| 322 | - name: Upload artifacts |
| 323 | if: always() |
| 324 | uses: actions/upload-artifact@v4 |
| 325 | with: |
| 326 | if-no-files-found: ignore |
| 327 | name: ostree |
| 328 | path: | |
| 329 | ostree-dependencies.log |
| 330 | ostree-build.log |
| 331 | ostree-install.log |
| 332 | ostree-verify-vendor.log |
| 333 | ostree-verify-altfiles.log |
| 334 | ostree-verify-altfiles-after.log |