<commit_before>- job:
    name: 'openstack-gerrit-rpm-packaging'
    description: "<b>This job is managed by JJB! Changes must be done in <a href='https://github.com/SUSE-Cloud/automation/tree/master/scripts/jenkins/jobs-obs/'>git</a></b>"
    node: openstack-rpm-packaging
    builders:
      - gerrit-git-prep
      - shell: |
          #!/bin/bash -e
          rpm -qa|grep '\(renderspec\|pymod2pkg\)'

          set -x

          # set vars
          OBS_BASE_SRC_PROJECT="Cloud:OpenStack:Upstream"
          OBS_BASE_TARGET_PROJECT="home:suse-cloud-ci:rpm-packaging-openstack"
          OBS_TEST_PROJECT="${OBS_BASE_TARGET_PROJECT}-${ZUUL_COMMIT}"
          TEMP_DIR="/tmp/rpm-packaging-${ZUUL_COMMIT}"

          # cleanup
          rm -rf ${OBS_TEST_PROJECT}
          rm -rf ${TEMP_DIR}
          osc rdelete -r -m "rpm-packaging CI cleanup" ${OBS_TEST_PROJECT} || :
          sleep 3

          # recreate the rpm-packaging tarball (as done by the tar_scm source service)
          mkdir ${TEMP_DIR}
          tar --exclude-vcs -cvjf ${TEMP_DIR}/rpm-packaging-0.0.1.tar.bz2 --transform 's,^,rpm-packaging-0.0.1/,' .

          # branch and checkout OBS project
          osc branch ${OBS_BASE_SRC_PROJECT} "rpm-packaging-openstack" ${OBS_TEST_PROJECT} || :
          sleep 2

          # create package links (needed if a new .spec.j2 was added)
          for spec_template in `find -name '*.spec.j2'`; do
              spec_basename=`basename $spec_template|sed 's/.spec.j2$//'`
              osc linkpac ${OBS_TEST_PROJECT} "rpm-packaging-openstack" ${OBS_TEST_PROJECT} python-${spec_basename} || :
          done
          sleep 2

          # checkout branched project, add updated stuff and commit
          osc co ${OBS_TEST_PROJECT}
          cp ${TEMP_DIR}/rpm-packaging-0.0.1.tar.bz2 ${OBS_TEST_PROJECT}/rpm-packaging-openstack
          pushd ${OBS_TEST_PROJECT}/rpm-packaging-openstack
          # download source files (needed for i.e. version updates or newly added .spec files)
          osc service run download_files
          bash -x pre_checkin.sh
          osc addremove
          osc status
          osc commit -m "rpm-packaging CI (${ZUUL_CHANGES})"

          popd
          pushd ${OBS_TEST_PROJECT}
          echo "#################################"
          echo "https://build.opensuse.org/project/show/${OBS_TEST_PROJECT}"
          echo "#################################"
          sleep 5

          # wait for build results (osc wait is buggy - https://github.com/openSUSE/osc/issues/180 )
          timeout 1h bash -c -- '
              while true; do
                  unset pending
                  unset failed
                  res=`osc results --csv -w -r SLE_12`
                  echo ">>: ${res}"
                  for r in $res; do
                      # some failures?
                      if [[ $r =~ (failed$|unresolvable$|broken$) ]]; then
                          failed=1
                      fi
                      # still pending builds?
                      if [[ $r =~ (blocked$|scheduled$|dispatching$|building$|signing$|finished$|outdated$) ]]; then
                          pending=1
                      fi
                  done
                  echo ">>: pending: $pending ; failed: $failed"
                  if [ -n "$pending" ]; then
                      sleep 5
                      continue
                  fi
                  if [ -n "$failed" ]; then
                      exit 1
                  else
                      break
                  fi
              done
          '

          exit 0<commit_msg>Fix pending job detection<commit_after>- job:
    name: 'openstack-gerrit-rpm-packaging'
    description: "<b>This job is managed by JJB! Changes must be done in <a href='https://github.com/SUSE-Cloud/automation/tree/master/scripts/jenkins/jobs-obs/'>git</a></b>"
    node: openstack-rpm-packaging
    builders:
      - gerrit-git-prep
      - shell: |
          #!/bin/bash -e
          rpm -qa|grep '\(renderspec\|pymod2pkg\)'

          set -x

          # set vars
          OBS_BASE_SRC_PROJECT="Cloud:OpenStack:Upstream"
          OBS_BASE_TARGET_PROJECT="home:suse-cloud-ci:rpm-packaging-openstack"
          OBS_TEST_PROJECT="${OBS_BASE_TARGET_PROJECT}-${ZUUL_COMMIT}"
          TEMP_DIR="/tmp/rpm-packaging-${ZUUL_COMMIT}"

          # cleanup
          rm -rf ${OBS_TEST_PROJECT}
          rm -rf ${TEMP_DIR}
          osc rdelete -r -m "rpm-packaging CI cleanup" ${OBS_TEST_PROJECT} || :
          sleep 3

          # recreate the rpm-packaging tarball (as done by the tar_scm source service)
          mkdir ${TEMP_DIR}
          tar --exclude-vcs -cvjf ${TEMP_DIR}/rpm-packaging-0.0.1.tar.bz2 --transform 's,^,rpm-packaging-0.0.1/,' .

          # branch and checkout OBS project
          osc branch ${OBS_BASE_SRC_PROJECT} "rpm-packaging-openstack" ${OBS_TEST_PROJECT} || :
          sleep 2

          # create package links (needed if a new .spec.j2 was added)
          for spec_template in `find -name '*.spec.j2'`; do
              spec_basename=`basename $spec_template|sed 's/.spec.j2$//'`
              osc linkpac ${OBS_TEST_PROJECT} "rpm-packaging-openstack" ${OBS_TEST_PROJECT} python-${spec_basename} || :
          done
          sleep 2

          # checkout branched project, add updated stuff and commit
          osc co ${OBS_TEST_PROJECT}
          cp ${TEMP_DIR}/rpm-packaging-0.0.1.tar.bz2 ${OBS_TEST_PROJECT}/rpm-packaging-openstack
          pushd ${OBS_TEST_PROJECT}/rpm-packaging-openstack
          # download source files (needed for i.e. version updates or newly added .spec files)
          osc service run download_files
          bash -x pre_checkin.sh
          osc addremove
          osc status
          osc commit -m "rpm-packaging CI (${ZUUL_CHANGES})"

          popd
          pushd ${OBS_TEST_PROJECT}
          echo "#################################"
          echo "https://build.opensuse.org/project/show/${OBS_TEST_PROJECT}"
          echo "#################################"
          sleep 5

          # wait for build results (osc wait is buggy - https://github.com/openSUSE/osc/issues/180 )
          timeout 1h bash -c -- '
              while true; do
                  unset pending
                  unset failed
                  res=`osc results --csv -w -r SLE_12`
                  echo ">>: ${res}"
                  for r in $res; do
                      # some failures?
                      if [[ $r =~ (failed$|unresolvable$|broken$) ]]; then
                          failed=1
                      fi
                      # still pending builds?
                      if [[ $r =~ (blocked$|scheduled$|dispatching$|building$|signing$|finished$|unknown|outdated$) ]]; then
                          pending=1
                      fi
                  done
                  echo ">>: pending: $pending ; failed: $failed"
                  if [ -n "$pending" ]; then
                      sleep 5
                      continue
                  fi
                  if [ -n "$failed" ]; then
                      exit 1
                  else
                      break
                  fi
              done
          '

          exit 0
{'fraction_non_alphanumeric': 0.12441184611126488, 'fraction_numerical': 0.008303349017437033, 'mean_word_length': 1.539353478566409, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5215550', 'n_tokens_mistral': 2238, 'n_tokens_neox': 2077, 'n_words': 490}