--- ############## # PARAMETERS # ############## - parameter: name: ta-parameters-manifest parameters: - string: default: refs/heads/master description: '' name: SCM_REFSPEC_MANIFEST trim: 'false' - parameter: name: ta-parameters-build-tools parameters: - string: default: refs/heads/master description: '' name: SCM_REFSPEC_BUILD_TOOLS trim: 'false' - parameter: name: ta-parameters-rpmbuilder parameters: - string: default: refs/heads/master description: '' name: SCM_REFSPEC_RPMBUILDER trim: 'false' - parameter: name: ta-parameters-ci parameters: - ta-parameters-manifest - ta-parameters-build-tools - ta-parameters-rpmbuilder - parameter: name: ta-parameters-ci-ta/rpmbuilder parameters: - ta-parameters-manifest - ta-parameters-build-tools - string: default: ta/yarf description: '' name: SCM_PROJECT_TO_BUILD trim: 'false' - string: default: refs/heads/master description: '' name: SCM_PROJECT_TO_BUILD_REFSPEC trim: 'false' ####### # SCM # ####### - scm: # Enhanced version of the global-jjb name: ta-lf-infra-gerrit-scm scm: - git: credentials-id: '{jenkins-ssh-credential}' url: '{git-url}' refspec: '{refspec}' branches: - 'refs/heads/{branch}' skip-tag: true wipe-workspace: true submodule: recursive: '{submodule-recursive}' timeout: '{submodule-timeout}' 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 # ########### - builder: name: lf-display-node-uuid 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"])' || true - builder: name: ta-builder-tox builders: - shell: |2- #!/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 popd done - builder: 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 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 \ -w work \ {project-to-build} find work/ fi - builder: 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 git fetch origin {ref} git checkout FETCH_HEAD else git checkout {ref} fi popd - builder: name: ta-lf-infra-ship-rpms builders: # Ensure no pre-existing .netrc files are overriding logs config - lf-provide-maven-settings-cleanup - config-file-provider: files: - file-id: 'ta-settings' variable: 'SETTINGS_FILE' - file-id: lftoolsini target: "$HOME/.config/lftools/lftools.ini" - file-id: sigul-config variable: SIGUL_CONFIG - file-id: sigul-password variable: SIGUL_PASSWORD - file-id: sigul-pki variable: SIGUL_PKI - file-id: signing-pubkey variable: SIGNING_PUBKEY - inject: 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: ../global-jjb/shell/sigul-configuration.sh - shell: !include-raw: ../global-jjb/shell/sigul-install.sh - shell: !include-raw: - ../shell/ta-rpm-deploy.sh - shell: !include-raw: - ../../global-jjb/shell/logs-clear-credentials.sh - builder: name: ta-lf-infra-ship-isos builders: # Ensure no pre-existing .netrc files are overriding logs config - lf-provide-maven-settings-cleanup - config-file-provider: files: - file-id: 'ta-settings' variable: 'SETTINGS_FILE' - file-id: lftoolsini target: "$HOME/.config/lftools/lftools.ini" - file-id: sigul-config variable: SIGUL_CONFIG - file-id: sigul-password variable: SIGUL_PASSWORD - file-id: sigul-pki variable: SIGUL_PKI - file-id: signing-pubkey variable: SIGNING_PUBKEY - lf-infra-create-netrc: server-id: images-snapshots - 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: ../global-jjb/shell/sigul-configuration.sh - shell: !include-raw: ../global-jjb/shell/sigul-install.sh - shell: !include-raw: - ../shell/ta-iso-deploy.sh - shell: !include-raw: - ../../global-jjb/shell/logs-clear-credentials.sh - builder: name: ta-builder-job-verify builders: - ta-builder-scm: git-url: '{git-url}' project: 'ta/manifest' ref: '$SCM_REFSPEC_MANIFEST' - ta-builder-scm: git-url: '{git-url}' project: 'ta/build-tools' ref: '$SCM_REFSPEC_BUILD_TOOLS' - ta-builder-scm: git-url: '{git-url}' project: 'ta/rpmbuilder' ref: '$SCM_REFSPEC_RPMBUILDER' - ta-builder-tox - ta-builder-rpm: project-to-build: '$GERRIT_PROJECT' - builder: name: ta-builder-job-verify-ta/rpmbuilder builders: - ta-builder-scm: git-url: '{git-url}' project: 'ta/manifest' ref: '$SCM_REFSPEC_MANIFEST' - ta-builder-scm: git-url: '{git-url}' project: 'ta/build-tools' ref: '$SCM_REFSPEC_BUILD_TOOLS' - ta-builder-scm: git-url: '{git-url}' project: '$SCM_PROJECT_TO_BUILD' ref: '$SCM_PROJECT_TO_BUILD_REFSPEC' - ta-builder-tox - ta-builder-rpm: # Just package some random project to verify "rpmbuilder" changes project-to-build: '$SCM_PROJECT_TO_BUILD' - builder: name: ta-builder-job-merge builders: - ta-builder-scm: git-url: '{git-url}' project: 'ta/manifest' ref: '$SCM_REFSPEC_MANIFEST' - ta-builder-scm: git-url: '{git-url}' project: 'ta/build-tools' ref: '$SCM_REFSPEC_BUILD_TOOLS' - ta-builder-scm: git-url: '{git-url}' project: 'ta/rpmbuilder' ref: '$SCM_REFSPEC_RPMBUILDER' - ta-builder-rpm: project-to-build: '$GERRIT_PROJECT' - ta-lf-infra-ship-rpms - builder: name: ta-builder-install-docker builders: - shell: |2- #!/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 # Ugly hack to make docker usable for non-root # (adding to the group would require re-login) sudo chmod 777 /var/run/docker.sock - builder: name: ta-builder-install-build-tools builders: - shell: |2- #!/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 ########### # TRIGGER # ########### - trigger: name: ta-trigger-job-verify triggers: - gerrit: server-name: '{gerrit-server-name}' trigger-on: - patchset-created-event: exclude-drafts: 'false' exclude-trivial-rebase: 'false' exclude-no-code-change: 'false' - draft-published-event - comment-added-contains-event: comment-contains-value: 'recheck' - comment-added-contains-event: comment-contains-value: 'reverify' projects: - project-compare-type: 'ANT' project-pattern: '{project}' branches: - 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 triggers: - gerrit: server-name: '{gerrit-server-name}' trigger-on: # Not sure if it would be better to use "change-merged" here and just clone the master # branch. With the current approach the SCM can be identical in verify and merge jobs. - ref-updated-event - comment-added-contains-event: comment-contains-value: 'remerge' projects: - project-compare-type: 'ANT' project-pattern: '{project}' branches: - branch-compare-type: 'ANT' branch-pattern: '**/{branch}' readable-message: true ############# # PUBLISHER # ############# - publisher: name: ta-publisher-job-verify publishers: - lf-infra-publish - publisher: name: ta-publisher-job-merge publishers: - ta-publisher-ci-build: arch: '{arch}' - trigger-parameterized-builds: - 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 -%}