From 16c292305f63962562b9c6607007f898ea0af8b6 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sat, 10 Feb 2024 14:05:57 +0900 Subject: [PATCH] Add CentOS Stream 9 job This introduces a functional tests which runs on CentOS Stream 9. Currently we use docker-ce in this job, but the job may be later updated to use podman, which is part of the distribution packages. Change-Id: Ic93c1c7faf46f641aa5988c688ebbef4a6e32ab4 --- .zuul.yaml | 7 ++++ devstack/plugin.sh | 50 ++++++++++++++++--------- playbooks/storlets-functional/post.yaml | 18 ++++++++- playbooks/storlets-functional/pre.yaml | 8 ---- src/java/SBus/build.xml | 5 +++ 5 files changed, 61 insertions(+), 27 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index 5ea3a3eb..8b2ff6d7 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -6,6 +6,7 @@ check: jobs: - storlets-functional + - storlets-functional-centos-9-stream gate: jobs: - storlets-functional @@ -28,3 +29,9 @@ - ^CHANGELOG$ - ^README.rst$ - ^tests/unit/.*$ + +- job: + name: storlets-functional-centos-9-stream + parent: storlets-functional + nodeset: centos-9-stream + voting: false diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 43058c59..51b5849f 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -50,8 +50,11 @@ SWIFT_CONF_DIR=${SWIFT_CONF_DIR:-/etc/swift} STORLETS_DEFAULT_USER_DOMAIN_ID=${STORLETS_DEFAULT_USER_DOMAIN_ID:-default} STORLETS_DEFAULT_PROJECT_DOMAIN_ID=${STORLETS_DEFAULT_PROJECT_DOMAIN_ID:-default} STORLETS_DOCKER_DEVICE=${STORLETS_DOCKER_DEVICE:-/var/lib/storlets} -STORLETS_DOCKER_BASE_IMG=${STORLETS_DOCKER_BASE_IMG:-ubuntu:22.04} -STORLETS_DOCKER_BASE_IMG_NAME=${STORLETS_DOCKER_BASE_IMG_NAME:-ubuntu_22.04} +if is_fedora; then + STORLETS_DOCKER_BASE_IMG=${STORLETS_DOCKER_BASE_IMG:-quay.io/centos/centos:stream9} +else + STORLETS_DOCKER_BASE_IMG=${STORLETS_DOCKER_BASE_IMG:-ubuntu:22.04} +fi STORLETS_SWIFT_RUNTIME_USER=${STORLETS_SWIFT_RUNTIME_USER:-$USER} STORLETS_SWIFT_RUNTIME_GROUP=${STORLETS_SWIFT_RUNTIME_GROUP:-$USER} STORLETS_STORLET_CONTAINER_NAME=${STORLETS_STORLET_CONTAINER_NAME:-storlet} @@ -134,9 +137,10 @@ function configure_swift_and_keystone_for_storlets { } function _install_docker { - # TODO: Add other dirstors. - # This one is geared towards Ubuntu - # See other projects that install docker + if is_fedora; then + # NOTE(tkajinam): install_docker.sh requires the yum command + sudo dnf install -y yum + fi wget http://get.docker.com -O install_docker.sh chmod 755 install_docker.sh sudo bash -x install_docker.sh @@ -150,47 +154,57 @@ function _install_docker { fi add_user_to_group $STORLETS_SWIFT_RUNTIME_USER docker + # Ensure docker daemon is started + start_service docker if [ $STORLETS_SWIFT_RUNTIME_USER == $USER ]; then # NOTE(takashi): We need this workaround because we can't reload # user-group relationship in bash scripts DOCKER_UNIX_SOCKET=/var/run/docker.sock sudo chown $USER:$USER $DOCKER_UNIX_SOCKET fi - - # Restart docker daemon - restart_service docker } function prepare_storlets_install { _install_docker - if is_ubuntu; then + if is_fedora; then + install_package java-${STORLETS_JDK_VERSION}-openjdk-devel ant + install_package python3 python3-devel + else install_package openjdk-${STORLETS_JDK_VERSION}-jdk-headless ant install_package python3 python3-dev - else - die $LINENO "Unsupported distro" fi } function _generate_jre_dockerfile { - PYTHON_PACKAGES="python3 python${PYTHON3_VERSION}" - - cat < ${TMP_REGISTRY_PREFIX}/repositories/${STORLETS_DOCKER_BASE_IMG_NAME}_jre${STORLETS_JDK_VERSION}/Dockerfile + if is_fedora; then + JDK_PACKAGE="java-${STORLETS_JDK_VERSION}-openjdk-headless" + PYTHON_PACKAGES="python3" + cat < ${TMP_REGISTRY_PREFIX}/repositories/storlet_engine_image/Dockerfile +FROM $STORLETS_DOCKER_BASE_IMG +MAINTAINER root +RUN dnf install ${PYTHON_PACKAGES} ${JDK_PACKAGE} util-linux-core -y && \ + dnf clean all +EOF + else + JDK_PACKAGE="openjdk-${STORLETS_JDK_VERSION}-jdk-headless" + PYTHON_PACKAGES="python3 python3.10" + cat < ${TMP_REGISTRY_PREFIX}/repositories/storlet_engine_image/Dockerfile FROM $STORLETS_DOCKER_BASE_IMG MAINTAINER root - RUN apt-get update && \ - apt-get install ${PYTHON_PACKAGES} openjdk-${STORLETS_JDK_VERSION}-jre-headless -y && \ + apt-get install ${PYTHON_PACKAGES} ${JDK_PACKAGE} -y && \ apt-get clean EOF + fi } function create_base_jre_image { echo "Create base jre image" sudo docker pull $STORLETS_DOCKER_BASE_IMG - mkdir -p ${TMP_REGISTRY_PREFIX}/repositories/"$STORLETS_DOCKER_BASE_IMG_NAME"_jre${STORLETS_JDK_VERSION} + mkdir -p ${TMP_REGISTRY_PREFIX}/repositories/storlet_engine_image _generate_jre_dockerfile - cd ${TMP_REGISTRY_PREFIX}/repositories/"$STORLETS_DOCKER_BASE_IMG_NAME"_jre${STORLETS_JDK_VERSION} + cd ${TMP_REGISTRY_PREFIX}/repositories/storlet_engine_image sudo docker build -t storlet_engine_image . cd - } diff --git a/playbooks/storlets-functional/post.yaml b/playbooks/storlets-functional/post.yaml index 90dec31b..30a5f6e1 100644 --- a/playbooks/storlets-functional/post.yaml +++ b/playbooks/storlets-functional/post.yaml @@ -6,7 +6,7 @@ path: '{{ zuul.project.src_dir }}/logs' state: directory - - name: Prepare the logs into user space + - name: Prepare the logs into user space (Ubuntu) shell: "egrep {{ item }} /var/log/syslog > {{ zuul.project.src_dir }}/logs/{{ item }}.log" with_items: - "account-server" @@ -17,6 +17,22 @@ - "storlets-daemon" - "daemon-factory" become: yes + when: + - ansible_os_family == 'Debian' + + - name: Prepare the logs into user space (CentOS) + shell: "egrep {{ item }} /var/log/messages > {{ zuul.project.src_dir }}/logs/{{ item }}.log" + with_items: + - "account-server" + - "container-server" + - "object-server" + - "proxy-server" + - "ansible" + - "storlets-daemon" + - "daemon-factory" + become: yes + when: + - ansible_os_family == 'RedHat' - name: Change log permisson as readable file: diff --git a/playbooks/storlets-functional/pre.yaml b/playbooks/storlets-functional/pre.yaml index 7b9acc2c..347abbbe 100644 --- a/playbooks/storlets-functional/pre.yaml +++ b/playbooks/storlets-functional/pre.yaml @@ -1,14 +1,6 @@ --- - hosts: all tasks: - - name: installing python3 packages - package: name={{ item }} state=present - with_items: - - python3 - - python3-venv - - python3-pip - become: yes - - shell: cmd: | set -e diff --git a/src/java/SBus/build.xml b/src/java/SBus/build.xml index b6423163..e83afa8b 100644 --- a/src/java/SBus/build.xml +++ b/src/java/SBus/build.xml @@ -39,8 +39,13 @@ + + + + +