X-Git-Url: https://gerrit.akraino.org/r/gitweb?p=ci-management.git;a=blobdiff_plain;f=jjb%2Fakraino-templates%2Fakraino-ta-common-macros.yaml;h=a0d578c57b50c4fcf03c0e92e187ca2bbb4083b1;hp=7006eac9ae0126f3acd303b2dc2a99a7c11493a5;hb=683452330b0784c355d032aae4454674d7fdc60e;hpb=a919490352dbd01f08d0b78e935ef90778c77dff diff --git a/jjb/akraino-templates/akraino-ta-common-macros.yaml b/jjb/akraino-templates/akraino-ta-common-macros.yaml index 7006eac..a0d578c 100644 --- a/jjb/akraino-templates/akraino-ta-common-macros.yaml +++ b/jjb/akraino-templates/akraino-ta-common-macros.yaml @@ -37,7 +37,7 @@ - ta-parameters-rpmbuilder - parameter: - name: ta-parameters-ci-ta-rpmbuilder + name: ta-parameters-ci-ta/rpmbuilder parameters: - ta-parameters-manifest - ta-parameters-build-tools @@ -73,6 +73,32 @@ choosing-strategy: '{choosing-strategy}' basedir: '{basedir}' +- scm: + name: ta-lf-infra-gerrit-scm-merge + scm: + - ta-lf-infra-gerrit-scm: + jenkins-ssh-credential: '{jenkins-ssh-credential}' + git-url: '{git-url}' + refspec: '{refspec}' + branch: '{branch}' + submodule-recursive: '{submodule-recursive}' + submodule-timeout: '{submodule-timeout}' + basedir: '{basedir}' + choosing-strategy: default + +- scm: + name: ta-lf-infra-gerrit-scm-verify + scm: + - ta-lf-infra-gerrit-scm: + jenkins-ssh-credential: '{jenkins-ssh-credential}' + git-url: '{git-url}' + refspec: '{refspec}' + branch: '{branch}' + submodule-recursive: '{submodule-recursive}' + submodule-timeout: '{submodule-timeout}' + basedir: '{basedir}' + choosing-strategy: gerrit + ########### # BUILDER # ########### @@ -81,15 +107,17 @@ builders: - shell: |2- echo "---> Node UUID:" - curl -s http://169.254.169.254/openstack/latest/meta_data.json | python -c 'import sys, json; data = json.load(sys.stdin); print(data["uuid"])' + curl -s http://169.254.169.254/openstack/latest/meta_data.json | python -c 'import sys, json; data = json.load(sys.stdin); print(data["uuid"])' || true - builder: name: ta-builder-tox builders: - - lf-pip-install: - pip-packages: tox - shell: |2- - source /tmp/v/tox/bin/activate + #!/bin/bash -ex + source ~/lf-env.sh + + lf-activate-venv tox + tox --version for f in $(find $GERRIT_PROJECT -name tox.ini); do pushd $(dirname $f) tox @@ -100,10 +128,34 @@ name: ta-builder-rpm builders: - shell: |2- + #!/bin/bash -ex # Skip RPM build in case no *.spec file is found within the {project-to-build} if [ -n "$(find {project-to-build} -name '*.spec')" ] then - sudo yum install -y createrepo + if apt --version 2>1 >/dev/null; then + # We need a specific version of mock (1.4.14) and devtools + # not available in Ubuntu/Debian repos, so fetch them from RHEL mirrors + if [ "$(mock --version 2>/dev/null)" != '1.4.14' ]; then + sudo groupadd mock || true + sudo usermod -aG mock $USER + sudo apt update + # Explicitly install mock dependencies + sudo apt install -y createrepo alien systemd-container python-pip \ + python-decoratortools yum-utils usermode pigz + wget http://vault.centos.org/centos/7.6.1810/os/x86_64/Packages/rpmdevtools-8.3-5.el7.noarch.rpm \ + https://kojipkgs.fedoraproject.org/packages/mock/1.4.14/2.el7/noarch/mock-1.4.14-2.el7.noarch.rpm + sudo alien -d *.rpm + sudo dpkg -i *.deb + rm -rf *.rpm *.deb + # RHEL tools hardcode the full path for certain distro tools + sudo ln -sf /bin/tar /usr/bin/gtar + sudo ln -sf /bin/machinectl /bin/df /usr/bin/ + # Some mock dependencies are only available via pip + sudo pip install distro pyroute2 + fi + else + sudo yum install -y createrepo + fi ta/build-tools/build_rpms.sh \ -m ta/manifest \ -r ta/rpmbuilder \ @@ -116,6 +168,8 @@ name: ta-builder-scm builders: - shell: |2- + #!/bin/bash -ex + rm -rf {project} git clone {git-url}/{project} {project} pushd {project} if echo {ref} | grep -q "refs/"; then @@ -139,15 +193,18 @@ properties-content: 'ALT_NEXUS_URL=https://nexus3.akraino.org' - lf-infra-create-netrc: server-id: rpm.snapshots + - inject: + properties-content: | + ALT_NEXUS_URL= + SERVER_ID= - shell: !include-raw: # Ensure python-tools are installed in case job template does not # call the lf-infra-pre-build macro. - ../../global-jjb/shell/python-tools-install.sh + - shell: !include-raw: - ../shell/ta-rpm-deploy.sh - shell: !include-raw: - ../../global-jjb/shell/logs-clear-credentials.sh - - inject: - properties-content: 'ALT_NEXUS_URL=' - builder: name: ta-lf-infra-ship-isos @@ -164,6 +221,7 @@ # Ensure python-tools are installed in case job template does not # call the lf-infra-pre-build macro. - ../../global-jjb/shell/python-tools-install.sh + - shell: !include-raw: - ../shell/ta-iso-deploy.sh - shell: !include-raw: - ../../global-jjb/shell/logs-clear-credentials.sh @@ -188,7 +246,7 @@ project-to-build: '$GERRIT_PROJECT' - builder: - name: ta-builder-job-verify-ta-rpmbuilder + name: ta-builder-job-verify-ta/rpmbuilder builders: - ta-builder-scm: git-url: '{git-url}' @@ -230,8 +288,21 @@ name: ta-builder-install-docker builders: - shell: |2- - sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo - sudo yum -y install docker-ce docker-ce-cli containerd.io + #!/bin/bash -ex + if apt --version 2>1 >/dev/null; then + sudo chmod +r /boot/vmlinuz* + if ! docker --version 2>1 >/dev/null; then + sudo apt update + sudo apt install -y apt-transport-https ca-certificates curl software-properties-common rename + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + sudo add-apt-repository -y "deb http://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + sudo apt update + sudo apt install -y docker-ce + fi + else + sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo + sudo yum -y install docker-ce docker-ce-cli containerd.io + fi sudo mkdir -p /etc/docker/ echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json sudo systemctl start docker @@ -243,7 +314,15 @@ name: ta-builder-install-build-tools builders: - shell: |2- - sudo yum -y install createrepo libguestfs-tools-c jq + #!/bin/bash -ex + if apt --version 2>1 >/dev/null; then + if ! createrepo --version 2>1 >/dev/null; then + sudo apt update + sudo apt install -y createrepo libguestfs-tools jq + fi + else + sudo yum -y install createrepo libguestfs-tools-c jq + fi sudo systemctl start libvirtd systemctl status libvirtd @@ -273,6 +352,11 @@ - branch-compare-type: 'ANT' branch-pattern: '**/{branch}' readable-message: true + skip-vote: + successful: '{gerrit-skip-vote}' + failed: '{gerrit-skip-vote}' + unstable: '{gerrit-skip-vote}' + notbuilt: '{gerrit-skip-vote}' - trigger: name: ta-trigger-job-merge @@ -305,8 +389,19 @@ - publisher: name: ta-publisher-job-merge publishers: - - lf-infra-publish + - ta-publisher-ci-build: + arch: '{arch}' - trigger-parameterized-builds: - - project: 'ta-ci-build' + - project: 'ta-ci-build-{arch}' condition: UNSTABLE_OR_BETTER trigger-with-no-params: true + +- publisher: + name: ta-publisher-ci-build + publishers: + - lf-infra-publish + - email: + recipients: !j2: | + {%- if 'arm64' in arch -%} + armband@enea.com + {%- endif -%}