From e20ee2585512cc5dabb8affcda5391dd637ba011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20LOYET?= <822436+fatpat@users.noreply.github.com> Date: Thu, 17 Dec 2020 09:25:20 +0100 Subject: [PATCH] Migrate from github to stash with packaging --- .cds/gridinit-build.pip.yml | 93 +++++++++++++++++++++++++++++ .cds/gridinit-mirror.pip.yml | 22 +++++++ .cds/gridinit-root.pip.yml | 3 + .cds/gridinit.app.yml | 7 +++ .cds/gridinit.yml | 42 +++++++++++++ .circleci/config.yml | 78 ------------------------ .travis.yml | 48 --------------- debian/compat | 1 + debian/control | 23 +++++++ debian/copyright | 38 ++++++++++++ debian/docs | 1 + debian/gridinit.service | 27 +++++++++ debian/gridinit.tmpfile | 1 + debian/patches/CMakeLists.txt.patch | 81 +++++++++++++++++++++++++ debian/rules | 21 +++++++ debian/source/format | 1 + 16 files changed, 361 insertions(+), 126 deletions(-) create mode 100644 .cds/gridinit-build.pip.yml create mode 100644 .cds/gridinit-mirror.pip.yml create mode 100644 .cds/gridinit-root.pip.yml create mode 100644 .cds/gridinit.app.yml create mode 100644 .cds/gridinit.yml delete mode 100644 .circleci/config.yml delete mode 100644 .travis.yml create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/docs create mode 100644 debian/gridinit.service create mode 100644 debian/gridinit.tmpfile create mode 100644 debian/patches/CMakeLists.txt.patch create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/.cds/gridinit-build.pip.yml b/.cds/gridinit-build.pip.yml new file mode 100644 index 0000000..82f719b --- /dev/null +++ b/.cds/gridinit-build.pip.yml @@ -0,0 +1,93 @@ +version: v1.0 +name: gridinit-build + +stages: + - compile + - package + +jobs: + - job: Test and compile + stage: compile + steps: + - name: Checkout Application + checkout: '{{ .cds.workspace }}' + - name: Prepare system and install dependencies + script: | + #!/bin/bash + cat $0 + set -ex + PKG='apt-get install -y --no-install-recommends' + export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true + echo "tzdata tzdata/Areas select Europe" > /tmp/preseed.txt + echo "tzdata tzdata/Zones/Europe select Brussels" >> /tmp/preseed.txt + debconf-set-selections /tmp/preseed.txt + apt-get update -q + $PKG tzdata ca-certificates + $PKG git pkg-config cmake make build-essential m4 autotools-dev autoconf automake libtool clang + $PKG libglib2.0-dev jq + - name: Compile local libdill (in order to be indenpendant from another package in testing) + script: | + #!/bin/bash + cat $0 + set -ex + cd vendor/libdill + export CC=clang + ./autogen.sh + ./configure --prefix=/usr --enable-shared --disable-static --disable-tls --disable-threads + make -j 8 + make install + - name: Compile and install gridinit + script: | + #!/bin/bash + cat $0 + set -ex + export CC=clang + cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VERBOSE_MAKEFILE=TRUE -DCMAKE_INSTALL_PREFIX=/usr . + make -j 8 + make install + - name: Test gridinit + script: | + #!/bin/bash + cat $0 + set -ex + export TMPDIR=/tmp + ./tools/gridinit-genconf.sh 15 + gridinit -d -s gridinit /tmp/gridinit/gridinit.conf + ./tools/cycle.sh + pkill gridinit + requirements: + - model: ubuntu-bionic + + - job: Package + stage: package + steps: + - name: Checkout application + checkout: '{{ .cds.workspace }}' + - name: Clone external-packages + script: + - eval $(worker key install --env-git proj-ssh-openio) + - git clone {{ .cds.proj.STASH_URL }}/openio/external-packages.git /external-packages + - name: Build package and upload + script: |+ + #!/bin/bash + cat $0 + set -x + export REPO_URL="https://{{ .cds.proj.drive_mirrors_objectstorage_openio_user }}:{{ .cds.proj.drive_mirrors_objectstorage_openio_password }}@{{ .cds.proj.drive_mirrors_hostname }}" + make -f /external-packages/ubuntu/bionic/Makefile.common install-apt-repo + # dev or prod release + if [[ "{{ .git.tag }}" =~ ^[0-9]+\. ]]; then + export VERSION={{ .git.tag }} + export REPO_SUBREPO=main + export REPO_LIMIT=0 + else + export VERSION=$(date +%Y%m%d%H%M).git{{ .git.hash.short }} + export REPO_SUBREPO=dev + export REPO_LIMIT=100 + fi + export PACKAGE=gridinit + + make -f /external-packages/ubuntu/bionic/Makefile.common deb_changelog + make -f /external-packages/ubuntu/bionic/Makefile.common + make -f /external-packages/ubuntu/bionic/Makefile.common upload_to_repo + requirements: + - model: openio-debbuild-18.04 diff --git a/.cds/gridinit-mirror.pip.yml b/.cds/gridinit-mirror.pip.yml new file mode 100644 index 0000000..7e3c11f --- /dev/null +++ b/.cds/gridinit-mirror.pip.yml @@ -0,0 +1,22 @@ +version: v1.0 +name: gridinit-mirror +jobs: +- job: Mirror to github + steps: + - name: Mirror to github + script: + # git clone directly in the script to prevent using checkout or gitclone action + # so we have full control on what we are doing + - set -x + - eval $(worker key install --env-git proj-ssh-openio) + # don't use --mirror to prevent mirroring pull requests ref + # that would be messy + - git clone --bare {{ .git.url }} {{ .cds.workspace }} + - cd {{ .cds.workspace }} + - git branch --all + # to remove branch to sync + #- git branch -D xxxx + - git push --mirror --prune --force https://openiobot:{{ .cds.proj.OPENIOBOT_GITHUB_TOKEN }}@github.com/open-io/gridinit.git + + requirements: + - binary: git diff --git a/.cds/gridinit-root.pip.yml b/.cds/gridinit-root.pip.yml new file mode 100644 index 0000000..b8c31a4 --- /dev/null +++ b/.cds/gridinit-root.pip.yml @@ -0,0 +1,3 @@ +version: v1.0 +name: gridinit-root +jobs: diff --git a/.cds/gridinit.app.yml b/.cds/gridinit.app.yml new file mode 100644 index 0000000..c77e5a1 --- /dev/null +++ b/.cds/gridinit.app.yml @@ -0,0 +1,7 @@ +version: v1.0 +name: gridinit +vcs_server: stash_ovh_net +repo: OPENIO/gridinit +vcs_connection_type: ssh +vcs_ssh_key: proj-ssh-openio +vcs_pgp_key: proj-pgp-openio diff --git a/.cds/gridinit.yml b/.cds/gridinit.yml new file mode 100644 index 0000000..755281f --- /dev/null +++ b/.cds/gridinit.yml @@ -0,0 +1,42 @@ +name: gridinit +version: v2.0 + +workflow: + root: + pipeline: gridinit-root + application: gridinit + + mirror: + pipeline: gridinit-mirror + application: gridinit + depends_on: + - root + + build: + pipeline: gridinit-build + application: gridinit + depends_on: + - root + conditions: + check: + - variable: cds.triggered_by.username + operator: ne + value: "cds.scheduler" + +metadata: + default_tags: git.branch,git.author + +retention_policy: return (git_branch_exist == "false" and run_days_before < 2) or run_days_before < 365 + +notifications: + - type: vcs + settings: + on_success: always + +hooks: + root: + - type: Scheduler + config: + # once very hour + cron: "56 * * * *" + timezone: UTC diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 31f1518..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,78 +0,0 @@ -version: 2.1 - -executors: - ubuntu-focal: - docker: - - image: ubuntu:focal - ubuntu-bionic: - docker: - - image: ubuntu:bionic - ubuntu-xenial: - docker: - - image: ubuntu:xenial - -workflows: - all-tests: - jobs: - - build: - matrix: - parameters: - os: [ubuntu-focal, ubuntu-bionic, ubuntu-xenial] - build-type: [Debug, RelWithDebInfo, MinSizeRel] - compiler: [gcc, clang] - -jobs: - build: - parameters: - os: - type: executor - build-type: - type: string - compiler: - type: string - executor: << parameters.os >> - steps: - - checkout - - run: - name: System dependencies - command: | - set -ex - PKG='apt-get install -y --no-install-recommends' - export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true - echo "tzdata tzdata/Areas select Europe" > /tmp/preseed.txt - echo "tzdata tzdata/Zones/Europe select Brussels" >> /tmp/preseed.txt - debconf-set-selections /tmp/preseed.txt - apt-get update -q - $PKG tzdata ca-certificates - $PKG git pkg-config cmake make build-essential m4 autotools-dev autoconf automake libtool << parameters.compiler >> - $PKG libglib2.0-dev jq - - run: - name: Pull Submodules - command: git submodule update --init --recursive - - run: - name: Build open-io/libdill - command: | - set -ex - cd vendor/libdill - export CC=<< parameters.compiler >> - ./autogen.sh - ./configure --prefix=/usr --enable-shared --disable-static --disable-tls --disable-threads - make -j 8 - make install - - run: - name: Build open-io/gridinit - command: | - set -ex - export CC=<< parameters.compiler >> - cmake -DCMAKE_BUILD_TYPE=<< parameters.build-type>> -DCMAKE_VERBOSE_MAKEFILE=TRUE -DCMAKE_INSTALL_PREFIX=/usr . - make -j 8 - make install - - run: - name: Test open-io/gridinit - command: | - set -ex - export TMPDIR=/tmp - ./tools/gridinit-genconf.sh 15 - gridinit -d -s gridinit /tmp/gridinit/gridinit.conf - ./tools/cycle.sh - pkill gridinit diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a1a3f35..0000000 --- a/.travis.yml +++ /dev/null @@ -1,48 +0,0 @@ -sudo: required -dist: bionic -language: c -git: - submodules: true -addons: - apt: - packages: - - autoconf - - automake - - autotools-dev - - build-essential - - clang - - cmake - - gcc - - jq - - libglib2.0-dev - - libtool - - m4 - - make - - sudo - - pkg-config -env: - matrix: - - BUILD_TYPE=Debug COMPILER=gcc - - BUILD_TYPE=Release COMPILER=gcc - - BUILD_TYPE=Debug COMPILER=clang - - BUILD_TYPE=Release COMPILER=clang -before_script: - - mkdir /tmp/oio - - export NBPROCS=$(nprocs --ignore=1) - - cd vendor/libdill - - ./autogen.sh - - ./configure --prefix=/usr --enable-shared --disable-static --disable-tls --disable-threads - - make -j ${NBPROCS} all - - sudo make install - - cd - - - export CC=$COMPILER - - cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=$BUILD_TYPE . - - make -j ${NBPROC} all - - sudo make install -script: - - set -e - - export TMPDIR=/tmp - - ./tools/gridinit-genconf.sh 15 - - gridinit -d -s gridinit /tmp/gridinit/gridinit.conf - - ./tools/cycle.sh - - pkill gridinit diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..641844e --- /dev/null +++ b/debian/control @@ -0,0 +1,23 @@ +Source: gridinit +Section: admin +Priority: optional +Maintainer: PU ObjectStorage +Uploaders: PU ObjectStorage +Build-Depends: debhelper (>= 9), + dh-systemd, + cmake, + libglib2.0-dev, + xutils-dev, + libdill, +Standards-Version: 3.9.5 + +Package: gridinit +Architecture: any +Depends: ${shlibs:Depends}, + ${misc:Depends}, + python3-setproctitle, +Description: OpenIO gridinit daemon + Init program used by the OpenIO Open Source Project. It forks processes + and respawns them as soon as they die. It also provides a simple management + interface through a UNIX socket. Services can be started/stopped/monitored. + OpenIO gridinit is a fork of Redcurrant gridinit, from Worldline by Atos. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..29d7508 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,38 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: openio-gridinit +Source: + +Files: * +Copyright: + +License: + + + . + + +# If you want to use GPL v2 or later for the /debian/* files use +# the following clauses, or change it to suit. Delete these two lines +Files: debian/* +Copyright: 2015 Romain Acciari +License: GPL-2+ + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. +# Please avoid to pick license terms that are more restrictive than the +# packaged work, as it may make Debian's contributions unacceptable upstream. diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..b43bf86 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README.md diff --git a/debian/gridinit.service b/debian/gridinit.service new file mode 100644 index 0000000..7383093 --- /dev/null +++ b/debian/gridinit.service @@ -0,0 +1,27 @@ +[Unit] +Description=Gridinit daemon from OpenIO +After=syslog.target network.target + +[Service] +User=root +Group=root +ExecStart=/usr/bin/gridinit -s GRIDINIT,local,gridinit,0 /etc/gridinit.conf +ExecReload=/usr/bin/gridinit_cmd reload +Restart=on-failure +LimitCPU=infinity +LimitFSIZE=infinity +LimitDATA=infinity +#LimitSTACK=infinity +LimitCORE=0 +LimitRSS=infinity +LimitNOFILE=500000 +LimitAS=infinity +#LimitNPROC=infinity +#LimitMEMLOCK=infinity +#LimitLOCKS=infinity +#LimitSIGPENDING=infinity +#LimitMSGQUEUE=infinity +TasksMax=infinity + +[Install] +WantedBy=multi-user.target diff --git a/debian/gridinit.tmpfile b/debian/gridinit.tmpfile new file mode 100644 index 0000000..b7a831f --- /dev/null +++ b/debian/gridinit.tmpfile @@ -0,0 +1 @@ +d /run/gridinit 755 root root - diff --git a/debian/patches/CMakeLists.txt.patch b/debian/patches/CMakeLists.txt.patch new file mode 100644 index 0000000..4c06bcb --- /dev/null +++ b/debian/patches/CMakeLists.txt.patch @@ -0,0 +1,81 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -32,48 +32,36 @@ endif () + set(CMAKE_C_FLAGS "-Wall -Wextra -Wunused -pipe -std=gnu99") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") + +-if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-variadic-macros") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wsequence-point") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wredundant-decls") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow") +- +- # gcc >= 4.2 +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wcomment") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmain") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wparentheses") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wfloat-equal") +- +- # gcc >= 4.6 +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-prototypes") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-field-initializers") +- #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Winline") +- #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion") +- #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wswitch-enum") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-parameter") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-variable") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-macros") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-value") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-function") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-result") +- +- if (CMAKE_COMPILER_IS_GNUCC) +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wtrampolines") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunsafe-loop-optimizations") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-but-set-parameter") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-but-set-variable") +- endif() +-else() +- message("The default compiler set in CC is not supported.") +- message("You need to use gcc (with a version >= 4.2) or Clang (version >= 9)") +- message("You can set your default compiler either by updating your CC variable environment:") +- message("export CC=/path/to/gcc") +- message("export CC=/path/to/clang-9") +- message("Or by adding a flag when calling CMake: ") +- message("-D CMAKE_C_COMPILER=gcc") +- message("-D CMAKE_C_COMPILER=clang-9") +- message( FATAL_ERROR "CMake will exit.") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-variadic-macros") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wsequence-point") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wredundant-decls") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow") ++ ++# gcc >= 4.2 ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wcomment") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmain") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wparentheses") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wfloat-equal") ++ ++# gcc >= 4.6 ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-prototypes") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-field-initializers") ++#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Winline") ++#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion") ++#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wswitch-enum") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-parameter") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-variable") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-macros") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-value") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-function") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-result") ++ ++if (CMAKE_COMPILER_IS_GNUCC) ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wtrampolines") ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunsafe-loop-optimizations") ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-but-set-parameter") ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-but-set-variable") + endif() + + diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..d799f1e --- /dev/null +++ b/debian/rules @@ -0,0 +1,21 @@ +#!/usr/bin/make -f +export DH_OPTIONS=-v + +include /usr/share/dpkg/default.mk + +# main packaging script based on dh7 syntax +%: + dh $@ --with=systemd + +override_dh_auto_configure: + for i in debian/patches/*.patch; do patch -f -p1 < $$i; done + dh_auto_configure -- \ + -DPREFIX=/usr \ + -DLD_LIBDIR=lib \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DGRIDINIT_SOCK_PATH="/run/gridinit/gridinit.sock" \ + -Wno-dev + +override_dh_install: + dh_install + install -m 755 tools/gridinit-syslog-logger debian/gridinit/usr/bin/gridinit-syslog-logger diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native)