data:
- __class__:
    module: tmt.steps.prepare.install
    name: PrepareInstallData
  copr: []
  directory: []
  exclude: []
  how: install
  missing: fail
  name: Install dependencies for further prepare steps
  order: 50
  package:
  - git-core
  - python-srpm-macros
  summary: null
  when: []
  where: []
- __class__:
    module: tmt.steps.prepare.shell
    name: PrepareShellData
  how: shell
  name: Download and build latest or pull request content
  order: 50
  ref: null
  script:
  - "set -xe\nif [ -n \"$CONTEST_CONTENT_BRANCH\" ]; then\n    ref=\"refs/heads/$CONTEST_CONTENT_BRANCH\"\nelif
    [ -n \"$CONTEST_CONTENT_PR\" ]; then\n    ref=\"refs/pull/$CONTEST_CONTENT_PR/head\"\nelse\n
    \   exit 0\nfi\ncontent_dir=/root/upstream-content\n[ -e \"$content_dir\" ] ||
    git init \"$content_dir\"\ncd \"$content_dir\"\nold_fetch_head=$(git rev-parse
    FETCH_HEAD 2>/dev/null) || true\ngit fetch --depth=1 https://github.com/ComplianceAsCode/content.git
    \"$ref\"\nnew_fetch_head=$(git rev-parse FETCH_HEAD)\nif [ \"$old_fetch_head\"
    != \"$new_fetch_head\" ]; then\n    # remove any previously built content\n    git
    clean -ffdx\n    git checkout FETCH_HEAD\nfi\necho \"CONTEST_CONTENT=$content_dir\"
    >> \"$TMT_PLAN_ENVIRONMENT_FILE\"\n"
  summary: null
  url: null
  when: []
  where: []
- __class__:
    module: tmt.steps.prepare.shell
    name: PrepareShellData
  how: shell
  name: Update OpenSCAP from Packit (if specified)
  order: 50
  ref: null
  script:
  - "set -xe\n# both result in the same URL on fedoraproject.org\nif [ -n \"$CONTEST_OSCAP_BRANCH\"
    ]; then\n    ref=\"$CONTEST_OSCAP_BRANCH\"\nelif [ -n \"$CONTEST_OSCAP_PR\" ];
    then\n    ref=\"$CONTEST_OSCAP_PR\"\nelse\n    exit 0\nfi\nrepofile=/etc/yum.repos.d/openscap-upstream-packit.repo\necho
    \"CONTEST_OSCAP_REPOFILE=$repofile\" >> \"$TMT_PLAN_ENVIRONMENT_FILE\"\nrm -f
    \"$repofile\"\nif rpm -q openscap-scanner; then\n    # the RPM might have been
    upgraded from another PR, sanitize it\n    dnf -q -y downgrade openscap-scanner\nelse\n
    \   # this runs before test dependencies are installed\n    dnf -q -y install
    openscap-scanner\nfi\n# download a Packit-provided repository\nmajor=$(. /etc/os-release
    && echo \"${VERSION_ID%%.*}\")\nrepourl=\"https://copr.fedorainfracloud.org/coprs/packit/OpenSCAP-openscap-$ref/repo/centos-stream-$major/packit-OpenSCAP-openscap-$ref-centos-stream-$major.repo\"\ncurl
    --retry 10 -sSfkL -o \"$repofile\" \"$repourl\"\ntrap \"rm -f \\\"$repofile\\\"\"
    ERR\n# check that the per-PR repo contains a newer build\nrc=0\ndnf -q check-upgrade
    openscap-scanner || rc=$?\nif [ \"$rc\" -ne 100 ]; then  # see dnf(8)\n    nvr=$(rpm
    -q openscap-scanner)\n    echo \"openscap-scanner from $ref doesn't upgrade existing
    $nvr\" >&2\n    false  # exit with ERR\nfi\ndnf -q -y upgrade openscap-scanner\n#
    invalidate VM snapshots\nrm -f /var/lib/libvirt/images/*.ready\n"
  summary: null
  url: null
  when: []
  where: []
status: done
