- job-template:
    name: '{name}-pypi-upload'
    node: pypi

    builders:
      - shell: |
          #!/bin/bash -xe
          TAG=`echo $ZUUL_REF | sed 's/^refs.tags.//'`
          FILENAME="{name}-$TAG.tar.gz"

          rm -rf *tar.gz
          curl -o $FILENAME http://{tarball-site}/{name}/$FILENAME

      - shell: |
          /usr/local/jenkins/slave_scripts/pypi-upload.sh {name}

    publishers:
      - console-log-post


- job-group:
    name: pypi-jobs
    jobs:
      - '{name}-pypi-upload'

- job-template:
    name: '{name}-pypi-upload'
    node: pypi

    builders:
      - shell: |
          #!/bin/bash -xe
          TAG=`echo $ZUUL_REF | sed 's/^refs.tags.//'`
          FILENAME="{name}-$TAG.tar.gz"

          rm -rf *tar.gz
          curl --fail -o $FILENAME http://{tarball-site}/{name}/$FILENAME
          # Make sure we actually got a gzipped file
          file -b $FILENAME | grep gzip

      - shell: |
          /usr/local/jenkins/slave_scripts/pypi-upload.sh {name}

    publishers:
      - console-log-post


- job-group:
    name: pypi-jobs
    jobs:
      - '{name}-pypi-upload'

Set curl to fail if HTTP servers return a error.
Set curl to fail if HTTP servers return a error.

* modules/openstack_project/files/jenkins_job_builder/config/pypi-jobs.yaml:
Use the curl's --fail option to detect some HTTP 400 and 500 errors.
Then check that the file is actually a gzipped file. The two checks are
necessary because some HTTP error codes do not result in a non zero
return from curl even with the --fail option.

Change-Id: I796d2c5767e787e7106040e7ef0098886135e68c
Reviewed-on: https://review.openstack.org/35562
Reviewed-by: Jeremy Stanley <98883b97e35b7bb1ac282bb863f2e9d917db0454@yuggoth.org>
Approved: Monty Taylor <37c07a49ee3d5191376d758eb1d8298b34456b8e@inaugust.com>
Reviewed-by: Monty Taylor <37c07a49ee3d5191376d758eb1d8298b34456b8e@inaugust.com>
Tested-by: Jenkins
