- job:
    name: openstack-api-ref
    node: ubuntu-xenial

    builders:
      - zuul-git-prep
      - install-distro-packages
      - revoke-sudo
      - run-tox:
          envlist: 'publishdocs-api'

    publishers:
      - upload-doc-build-results
      - afs:
          site: afs-developer-docs
          source: 'publish-docs/api-ref/**'
          target: '/'
          remove-prefix: 'publish-docs/api-ref/'
      - test-results
      - console-log

- job:
    name: openstack-api-ref-publish-lang
    node: ubuntu-xenial

    builders:
      - zuul-git-prep
      - install-distro-packages
      - revoke-sudo
      - run-tox:
          envlist: 'publishlang-api'

    publishers:
      - upload-doc-build-results
      - afs:
          site: afs-developer-docs
          source: 'publish-docs/api-ref/**'
          target: '/'
          remove-prefix: 'publish-docs/api-ref/'
      - test-results
      - console-log

- job-template:
    name: gate-{name}-api-guide
    description: Build and draft the API Guide from source.
    node: ubuntu-xenial

    builders:
      - zuul-git-prep-upper-constraints
      - install-distro-packages
      - revoke-sudo
      - run-tox:
          envlist: 'api-guide'

    publishers:
      - upload-api-guide-draft
      - test-results
      - console-log

- job-template:
    name: '{name}-api-guide'
    description: Build and publish the API Guide from source.
    node: ubuntu-xenial

    builders:
      - zuul-git-prep-upper-constraints
      - install-distro-packages
      - revoke-sudo
      - run-tox:
          envlist: 'api-guide'
      - add-docs-root-marker:
          docsrootdir: api-guide/build/html

    publishers:
      - afs:
          site: afs-developer-docs
          source: 'api-guide/build/html/**'
          target: 'api-guide/{service}'
          remove-prefix: 'api-guide/build/html/'
      - test-results
      - console-log

# Be aware that the variable "service" needs to be set when this job
# group is used.
# The "service" variable comes from the service catalog, which is
# based on the openstack/service-types-authority project as a
# canonical reference for names. When your project has spaces in the
# service entry, use dashes for the spaces, such as "object-storage"
# (the service is not swift).
- job-group:
    name: api-guide-jobs

    jobs:
      - gate-{name}-api-guide
      - '{name}-api-guide'

- job-template:
    name: gate-{name}-api-ref
    description: Build and draft the API Reference from source.
    node: ubuntu-xenial

    builders:
      - zuul-git-prep-upper-constraints
      - install-distro-packages
      - revoke-sudo
      - run-tox:
          envlist: 'api-ref'

    publishers:
      - upload-api-ref-draft
      - test-results
      - console-log

- job-template:
    name: gate-placement-api-ref-nv
    description: Build and draft the placement API Reference from source.
    node: ubuntu-xenial

    builders:
      - zuul-git-prep-upper-constraints
      - install-distro-packages
      - revoke-sudo
      - run-tox:
          envlist: 'placement-api-ref'

    publishers:
      - upload-placement-api-ref-draft
      - test-results
      - console-log

- job-template:
    name: gate-{name}-api-ref-src
    description: Build and draft the API Reference from source using os-api-ref from source.
    node: ubuntu-xenial

    builders:
      - zuul-git-prep-upper-constraints-api-ref:
          project: openstack/{name}
      - install-distro-packages
      - revoke-sudo
      - shell: "/usr/local/jenkins/slave_scripts/run-tox-api-ref.sh"

    publishers:
      - upload-api-ref-draft
      - test-results
      - console-log

- job-template:
    name: '{name}-api-ref'
    description: Build and publish the API Reference from source.
    node: ubuntu-xenial

    builders:
      - zuul-git-prep-upper-constraints
      - install-distro-packages
      - revoke-sudo
      - run-tox:
          envlist: 'api-ref'
      - add-docs-root-marker:
          docsrootdir: api-ref/build/html

    publishers:
      - afs:
          site: afs-developer-docs
          source: 'api-ref/build/html/**'
          target: 'api-ref/{service}'
          remove-prefix: 'api-ref/build/html/'
      - test-results
      - console-log

# Be aware that the variable "service" needs to be
# set when this job group is used.
# The "service" variable comes from the service catalog, which is
# based on the openstack/service-types-authority project as a
# canonical reference for names. When your project has spaces in the
# service entry, use dashes for the spaces, such as "object-storage"
# (the service is not swift).
- job-group:
    name: api-ref-jobs

    jobs:
      - gate-{name}-api-ref
      - gate-{name}-api-ref-src
      - '{name}-api-ref'

- job:
    name: python-openstacksdk-docs
    description: Build and publish the Python SDK docs from source.
    node: ubuntu-xenial

    builders:
      - zuul-git-prep
      - install-distro-packages
      - revoke-sudo
      - docs

    publishers:
      - afs:
          site: afs-developer-docs
          source: 'doc/build/html/**'
          target: 'sdks/python/openstacksdk'
          remove-prefix: 'doc/build/html/'
      - test-results
      - console-log

- job:
    name: murano-firstapp-docs
    description: Build and publish the Murano Firstapp docs from source.
    node: ubuntu-xenial

    builders:
      - zuul-git-prep-upper-constraints
      - install-distro-packages
      - revoke-sudo
      - run-tox:
          envlist: 'murano-firstapp'
      - add-docs-root-marker:
          docsrootdir: doc/build/murano-firstapp/html

    publishers:
      - afs:
          site: afs-developer-docs
          source: 'doc/build/murano-firstapp/html/**'
          target: 'murano-firstapp'
          remove-prefix: 'doc/build/murano-firstapp/html/'
      - test-results
      - console-log

- job:
    name: gate-murano-firstapp-docs
    description: Build and publish draft of the Murano Firstapp docs.
    node: ubuntu-xenial

    builders:
      - zuul-git-prep-upper-constraints
      - install-distro-packages
      - revoke-sudo
      - run-tox:
          envlist: 'murano-firstapp'

    publishers:
      - scp:
          site: 'static.openstack.org'
          files:
            - target: 'docs-draft/$LOG_PATH'
              source: 'doc/build/murano-firstapp/html/**'
              keep-hierarchy: true
              copy-after-failure: true
      - test-results
      - console-log