Skip to content

github: combine nightly jobs with default jobs using matrix #1126

github: combine nightly jobs with default jobs using matrix

github: combine nightly jobs with default jobs using matrix #1126

Workflow file for this run

name: Samba Container Image CI
on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
- cron: '0 2 * * *'
env:
CONTAINER_CMD: docker
jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# We need a newer version of shellcheck to avoid problems with the
# relative imports. Our scripts work on v0.7.2 and up but not the
# v0.7.0 preinstalled in the ubutnu image. We can force a local
# install by expliclity setting SHELLCHECK to `$ALT_BIN/shellcheck`
- name: Run static check tools
run: make check SHELLCHECK=$PWD/.bin/shellcheck
check-commits:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Ensure branches
run: git fetch
- name: Lint git commit messages
run: make check-gitlint
build-server:
# Reminder: the nightly-server images consume nightly samba rpm builds
# it is not *just* an image that gets built nightly
strategy:
matrix:
package_source: [default, nightly]
os: [centos, fedora, opensuse]
arch: [amd64]
exclude:
# there are no nightly packages for opensuse
- package_source: nightly
os: opensuse
runs-on: ubuntu-latest
env:
BUILDAH_FORMAT: oci
IMG_TAG: ${{ matrix.package_source }}-${{ matrix.os }}-${{ matrix.arch }}
steps:
- uses: actions/checkout@v3
- name: Build the server image
run: make KIND=server PACKAGE_SOURCE=${{ matrix.package_source }} OS_NAME=${{ matrix.os}} BUILD_ARCH=${{ matrix.arch}} build-image
- name: Upload server image
uses: ishworkh/[email protected]
with:
image: "samba-server:${{ env.IMG_TAG }}"
container_engine: ${{ env.CONTAINER_CMD }}
retention_days: 1
build-ad-server:
strategy:
matrix:
package_source: [default, nightly]
os: [centos, fedora, opensuse]
arch: [amd64]
exclude:
# there are no nightly packages for opensuse
- package_source: nightly
os: opensuse
# the distro packages for centos do not include an ad-dc
- package_source: default
os: centos
runs-on: ubuntu-latest
env:
BUILDAH_FORMAT: oci
IMG_TAG: ${{ matrix.package_source }}-${{ matrix.os }}-${{ matrix.arch }}
steps:
- uses: actions/checkout@v3
- name: Build the ad server image
run: make KIND=ad-server PACKAGE_SOURCE=${{ matrix.package_source }} OS_NAME=${{ matrix.os }} BUILD_ARCH=${{ matrix.arch }} build-image
- name: Upload ad server image
uses: ishworkh/[email protected]
with:
image: "samba-ad-server:${{ env.IMG_TAG }}"
container_engine: ${{ env.CONTAINER_CMD }}
retention_days: 1
build-client:
strategy:
matrix:
os: [centos, fedora, opensuse]
arch: [amd64]
runs-on: ubuntu-latest
env:
BUILDAH_FORMAT: oci
IMG_TAG: default-${{ matrix.os }}-${{ matrix.arch }}
steps:
- uses: actions/checkout@v3
- name: build the client image
run: make KIND=client OS_NAME=${{ matrix.os }} BUILD_ARCH=${{ matrix.arch }} build-image
# Here we upload samba-client image to artifacts locally for consumption
# during the samba-toolbox build process.
- name: Upload the client image
uses: ishworkh/[email protected]
with:
image: "samba-client:${{ env.IMG_TAG }}"
container_engine: ${{ env.CONTAINER_CMD }}
retention_days: 1
build-toolbox:
strategy:
matrix:
os: [centos, fedora, opensuse]
arch: [amd64]
needs: build-client
runs-on: ubuntu-latest
env:
BUILDAH_FORMAT: oci
IMG_TAG: default-${{ matrix.os }}-${{ matrix.arch }}
steps:
- uses: actions/checkout@v3
# Download locally stored samba-client image to be used as base for building
# samba-toolbox.
- name: Download client image
uses: ishworkh/[email protected]
with:
image: "samba-client:${{ env.IMG_TAG }}"
container_engine: ${{ env.CONTAINER_CMD }}
# Workaround: retag the image so that the FQIN image matches the name in
# the toolbox containerfiles.
- name: Apply OS-latest tag to image (for centos)
run: ${{ env.CONTAINER_CMD }} tag samba-client:${{ env.IMG_TAG }} quay.io/samba.org/samba-client:${{ matrix.os }}-latest
- name: Apply latest tag to image (for fedora)
run: ${{ env.CONTAINER_CMD }} tag samba-client:${{ env.IMG_TAG }} quay.io/samba.org/samba-client:latest
- name: Build the toolbox image
run: make KIND=toolbox OS_NAME=${{ matrix.os }} BUILD_ARCH=${{ matrix.arch }} build-image
test-server:
strategy:
matrix:
package_source: [default, nightly]
os: [centos, fedora, opensuse]
arch: [amd64]
exclude:
# there are no nightly packages for opensuse
- package_source: nightly
os: opensuse
needs: build-server
runs-on: ubuntu-latest
env:
BUILDAH_FORMAT: oci
IMG_TAG: ${{ matrix.package_source }}-${{ matrix.os }}-${{ matrix.arch }}
steps:
- uses: actions/checkout@v3
- name: Download server image
uses: ishworkh/[email protected]
with:
image: "samba-server:${{ env.IMG_TAG }}"
container_engine: ${{ env.CONTAINER_CMD }}
- name: Test the server image
run: LOCAL_TAG=samba-server:${{ env.IMG_TAG }} tests/test-samba-container.sh
test-ad-server-kubernetes:
strategy:
matrix:
package_source: [default, nightly]
os: [centos, fedora, opensuse]
arch: [amd64]
exclude:
# there are no nightly packages for opensuse
- package_source: nightly
os: opensuse
# the distro packages for centos do not include an ad-dc
- package_source: default
os: centos
needs:
- build-ad-server
- build-server
# need to explicitly use 20.04 to avoid problems with jq...
runs-on: ubuntu-20.04
env:
BUILDAH_FORMAT: oci
IMG_TAG: ${{ matrix.package_source }}-${{ matrix.os }}-${{ matrix.arch }}
steps:
- uses: actions/checkout@v3
- uses: nolar/setup-k3d-k3s@v1
- name: get nodes
run: kubectl get nodes
- name: Download ad server image
uses: ishworkh/[email protected]
with:
image: "samba-ad-server:${{ env.IMG_TAG }}"
container_engine: ${{ env.CONTAINER_CMD }}
- name: Download file server image
uses: ishworkh/[email protected]
with:
image: "samba-server:${{ env.IMG_TAG }}"
container_engine: ${{ env.CONTAINER_CMD }}
- name: import images to k3d
run: k3d image import samba-server:${{ env.IMG_TAG }} samba-ad-server:${{ env.IMG_TAG }}
- name: run the ad-dc deployment test
run: ./tests/test-samba-ad-server-kubernetes.sh
push:
# verify it passes the test jobs first
needs:
- build-client
- build-toolbox
- test-server
- test-ad-server-kubernetes
runs-on: ubuntu-latest
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.repository == 'samba-in-kubernetes/samba-container'
steps:
- uses: actions/checkout@v3
- name: log in to quay.io
run: docker login -u "${{ secrets.QUAY_USER }}" -p "${{ secrets.QUAY_PASS }}" quay.io
- name: push server image
run: make push-server
- name: push ad-server image
run: make push-ad-server
- name: push client image
run: make push-client
- name: push toolbox image
run: make push-toolbox
- name: push nightly server image
run: make push-nightly-server
- name: push nightly ad server image
run: make push-nightly-ad-server