Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions jobs/nightly-samba-containers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
- project:
name: samba_nightly-containers
os_name:
- 'centos'
- 'fedora'
os_arch:
- 'aarch64'
- 'x86_64'
kind:
- 'server'
package_source:
- 'default'
- 'devbuilds'
- 'nightly'
exclude:
# ceph development rpm builds are not available for fedora
- os_name: 'fedora'
package_source: 'devbuilds'
# resilient storage providing ctdb on centos is not available for aarch64
- os_name: 'centos'
os_arch: 'aarch64'
package_source: 'default'
jobs:
- 'samba_build-containers-{kind}-{package_source}-{os_name}-{os_arch}'

- job-template:
name: 'samba_build-containers-{kind}-{package_source}-{os_name}-{os_arch}'
node: cico-workspace
description: Build Samba containers.
project-type: freestyle
concurrent: true

parameters:
- string:
name: CENTOS_VERSION
default: '9s'
description: CentOS version to be installed on host node
- string:
name: OS_NAME
default: '{os_name}'
description: Platform to build the containers
- string:
name: OS_ARCH
default: '{os_arch}'
description: Architecture to build the containers
- string:
name: KIND
default: '{kind}'
description: Type of samba server
- string:
name: PACKAGE_SOURCE
default: '{package_source}'
description: Repository with required packages

wrappers:
- credentials-binding:
- username-password-separated:
credential-id: container-registry-auth
username: IMG_REGISTRY_USER
password: IMG_REGISTRY_PASSWORD

scm:
- git:
url: https://github.com/samba-in-kubernetes/samba-centosci.git

properties:
- github:
url: https://github.com/samba-in-kubernetes/samba-container
- build-discarder:
days-to-keep: 7
artifacts-days-to-keep: 7

triggers:
- timed: "H 3 * * *"
- pollurl:
cron: 'H/5 * * * *'
urls:
- url: 'https://github.com/samba-in-kubernetes/samba-container/commit/main.patch'
check-content:
- simple: true

builders:
- shell: !include-raw-escape: scripts/common/get-node.sh
- shell: !include-raw-escape: scripts/common/scp.sh
- shell: |
#!/bin/bash
jobs/scripts/common/bootstrap.sh $WORKSPACE/jobs/scripts/nightly-samba-containers/nightly-samba-containers.sh "OS_NAME=$OS_NAME OS_ARCH=$OS_ARCH KIND=$KIND PACKAGE_SOURCE=$PACKAGE_SOURCE IMG_REGISTRY_USER=$IMG_REGISTRY_USER IMG_REGISTRY_PASSWORD=$IMG_REGISTRY_PASSWORD"

publishers:
- email-ext:
recipients: [email protected]
reply-to: $DEFAULT_REPLYTO
subject: $DEFAULT_SUBJECT
content-type: text
body: $DEFAULT_CONTENT
- post-tasks:
- matches:
- log-text: Building remotely
script:
!include-raw-escape: scripts/common/return-node.sh
2 changes: 1 addition & 1 deletion jobs/scripts/common/get-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ client:
key: ${CICO_API_KEY}
EOF

if [[ "${JOB_NAME}" =~ rpms ]]; then
if [[ "${JOB_NAME}" =~ rpms|containers ]]; then
POOL_MATCH="^(virt-ec2)(.*)(centos-${CENTOS_VERSION}-${OS_ARCH})$"
else
POOL_MATCH="^(metal-ec2)(.*)(centos-${CENTOS_VERSION}-${OS_ARCH})$"
Expand Down
41 changes: 41 additions & 0 deletions jobs/scripts/nightly-samba-containers/nightly-samba-containers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

CONTAINER_GIT_REPO="https://github.com/samba-in-kubernetes/samba-container"
CONTAINER_GIT_BRANCH="master"
CONTAINER_CMD=${CONTAINER_CMD:-podman}
IMG_REGISTRY="quay.io"
# Temporarily using John Mulligan's quay.io repository with a bot account until
# jobs are complete and stable enough for container images to be published on
# quay.io/samba.org
IMG_REGISTRY_BASE="${IMG_REGISTRY}/phlogistonjohn"
# At the moment we are interested in pushing unqualified tags only for x86_64
PUSH_TAGS_SELECTION=$([[ $OS_ARCH != "x86_64" ]] && echo "fqin" || echo "mixed")

# if anything fails, we'll abort
set -e

dnf -y install git make podman

git clone --depth=1 --branch="${CONTAINER_GIT_BRANCH}" \
"${CONTAINER_GIT_REPO}" "${CONTAINER_GIT_BRANCH}"
cd "${CONTAINER_GIT_BRANCH}"

make KIND=${KIND} OS_NAME=${OS_NAME} PACKAGE_SOURCE=${PACKAGE_SOURCE} \
BUILD_ARCH=${OS_ARCH} build-image

IMAGE=$(./hack/build-image --kind ${KIND} --distro-base ${OS_NAME} \
--package-source ${PACKAGE_SOURCE} --arch ${OS_ARCH} \
--print)

./hack/build-image --retag --container-engine ${CONTAINER_CMD} \
--repo-base ${IMG_REGISTRY_BASE} --no-distro-qualified \
-i ${IMAGE}

podman login -u ${IMG_REGISTRY_USER} \
-p ${IMG_REGISTRY_PASSWORD} ${IMG_REGISTRY}

./hack/build-image --push --container-engine ${CONTAINER_CMD} --verbose \
--push-state "exists" --push-selected-tags ${PUSH_TAGS_SELECTION} \
-i ${IMG_REGISTRY_BASE}/${IMAGE}

podman logout ${IMG_REGISTRY}
Loading