Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build-make-check-container job. Changes ready for merging #1976

Closed
wants to merge 1 commit into from
Closed
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
45 changes: 45 additions & 0 deletions build-make-check-container/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This is just the default. Overridden by `docker build --build-arg DISTRO=$DISTRO` at build time
ARG DISTRO='ubuntu:20.04'
FROM $DISTRO
RUN if command -v yum; then \
yum install -y epel-release; \
yum install -y git sudo ccache clang; \
yum update -y; \
else \
apt update && DEBIAN_FRONTEND="noninteractive" apt install -y git-core sudo ccache; \
fi
RUN git clone https://github.com/ceph/ceph /opt/ceph
RUN git clone https://github.com/ceph/ceph-ci /opt/ceph-ci
# Set some defaults (again, overridden using --build-arg)
ARG INSTALL_DEPS_REPO=ceph
ARG INSTALL_DEPS_BRANCH=master
RUN cd /opt/$INSTALL_DEPS_REPO \
&& if ! git checkout $INSTALL_DEPS_BRANCH; then \
echo $INSTALL_DEPS_BRANCH doesn\'t exist; \
exit 1; \
fi \
&& DEBIAN_FRONTEND="noninteractive" ./install-deps.sh \
&& git submodule update --init --recursive
# Doesn't work yet
# # To populate ccache
# && ./src/script/run-make.sh \
# && rm -rf build
# Some defaults. Overridden by `docker run -e VAR=$VAR` at runtime
ENV REPO=${REPO:-ceph}
ENV BRANCH=${BRANCH:-master}
ENV PULLREQUEST_ID=${PULLREQUEST_ID}
# Uncertain on the proper order here. Do I need to `pull` after checking out the branch again?
CMD cd /opt/$REPO \
&& git fetch --all \
&& if [ "$PULLREQUEST_ID" == "" ]; then \
echo "PULLREQUEST_ID was not defined. Using the \$BRANCH var"; \
echo -e "****************\n\nChecking out branch: $BRANCH\n\n****************"; \
git checkout $BRANCH; \
git pull; \
else \
echo -e "****************\n\nChecking out Pull Request ID: $PULLREQUEST_ID\n\n****************"; \
git fetch origin pull/$PULLREQUEST_ID/head:PR$PULLREQUEST_ID; \
git checkout PR$PULLREQUEST_ID; \
fi \
&& ./install-deps.sh \
&& timeout 3h ./run-make-check.sh
20 changes: 20 additions & 0 deletions build-make-check-container/build/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
set -e

# Uncomment these to run locally on your workstation
#DISTRO="ubuntu:20.04"
#DISTRO="centos:8"
#BRANCH=${BRANCH:-master}
#WORKSPACE=~/git/ceph/ceph-build

DASHED_DISTRO=$(echo "$DISTRO" | sed 's/:/-/')

cd "$WORKSPACE"/build-make-check-container/build

sudo docker build --build-arg INSTALL_DEPS_BRANCH=$BRANCH --build-arg DISTRO=$DISTRO -t make-check:$BRANCH-$DASHED_DISTRO .

sudo docker login -u "${REGISTRY_USERNAME}" -p "${REGISTRY_PASSWORD}" quay.ceph.io

sudo docker image tag make-check:$BRANCH-$DASHED_DISTRO quay.ceph.io/cephci/make-check:$BRANCH-$DASHED_DISTRO

sudo docker push quay.ceph.io/cephci/make-check:$BRANCH-$DASHED_DISTRO
29 changes: 29 additions & 0 deletions build-make-check-container/build/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -ex

if [[ $(command -v docker) == '' ]]; then
# Set up docker official repo and install docker.
sudo apt update -y
sudo apt install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update -y
sudo apt install -y docker-ce docker-ce-cli containerd.io
fi
sudo groupadd docker || true
sudo usermod -aG docker $(id -un)
sudo systemctl start docker
sudo chgrp "$(id -un)" /var/run/docker.sock

docker info
docker container prune -f


Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
- job:
name: build-make-check-container
node: master
project-type: matrix
defaults: global
display-name: 'Builds the ceph-make-check container and pushes to quay.ceph.io'
quiet-period: 5
block-downstream: false
block-upstream: false
retry-count: 3
execution-strategy:
combination-filter: |
!(BRANCH=="master" && DISTRO=="centos:7") &&
!(BRANCH=="pacific" && DISTRO=="centos:7") &&
!(BRANCH=="master" && DISTRO=="ubuntu:18.04") &&
!(BRANCH=="pacific" && DISTRO=="ubuntu:18.04")
properties:
- build-discarder:
days-to-keep: 14

# parameters:
# - string:
# name: BRANCH
# description: "Base branch you want to the container to have install-deps run for"
# default: master
#
# - string:
# name: DISTRO
# description: "Distro you want install-deps run on"
# default: 'ubuntu:20.04'

axes:
- axis:
type: label-expression
name: MACHINE_SIZE
values:
- huge
- axis:
type: label-expression
name: MACHINE_TYPE
values:
- focal
- axis:
type: label-expression
name: MACHINE_ARCH
values:
- x86_64

- axis:
type: user-defined
name: BRANCH
values:
- master
- octopus
- pacific

- axis:
type: user-defined
name: DISTRO
values:
- 'centos:7'
- 'centos:8'
- 'ubuntu:18.04'
- 'ubuntu:20.04'

triggers:
- timed: '@daily'

scm:
- git:
url: https://github.com/ceph/ceph-build.git
branches:
- build-make-check-container
browser: auto
timeout: 20

builders:
- shell:
!include-raw:
# - ../../../scripts/build_utils.sh
- ../../build/setup
- ../../build/build

wrappers:
- inject-passwords:
global: true
mask-password-params: true
- credentials-binding:
- username-password-separated:
credential-id: quay-ceph-io-make-check-bot
username: REGISTRY_USERNAME
password: REGISTRY_PASSWORD