version: v1.0
name: Initial Pipeline
agent:
  machine:
    type: e1-standard-4
    os_image: ubuntu1804
global_job_config:
  secrets:
  - name: docker-hub
  prologue:
    commands:
    - echo $DOCKERHUB_PASSWORD | docker login --username "$DOCKERHUB_USERNAME" --password-stdin
    - sudo apt-get update
    - sudo apt-get install -y python-all-dev python3-all-dev python3-pip crudini
    - sudo pip3 install tox
    # Disable initramfs update, as it means we run out of space on the Semaphore
    # VM (and we don't need it because we're not going to reboot).
    - sudo crudini --set /etc/initramfs-tools/update-initramfs.conf '' update_initramfs no
    - cat /etc/initramfs-tools/update-initramfs.conf

blocks:
  - name: 'Testing'
    task:
      jobs:
        - name: 'Unit and FV tests (tox)'
          commands:
            - checkout
            - tox
        - name: 'Mainline ST (DevStack + Tempest) on Ussuri'
          commands:
            - checkout
            - git checkout -b devstack-test
            - mkdir -p ~/calico
            - ln -s `pwd` ~/calico/networking-calico
            - export LIBVIRT_TYPE=qemu
            - export UPPER_CONSTRAINTS_FILE=https://releases.openstack.org/constraints/upper/ussuri
            # Use proposed fix at
            # https://review.opendev.org/c/openstack/requirements/+/810859.  See commit
            # message for more context.
            - export REQUIREMENTS_REPO=https://review.opendev.org/openstack/requirements
            - export REQUIREMENTS_BRANCH=refs/changes/59/810859/1
            - TEMPEST=true DEVSTACK_BRANCH=stable/ussuri ./devstack/bootstrap.sh
      epilogue:
        on_fail:
          commands:
            - mkdir logs
            - sudo journalctl > logs/journalctl.txt
            - artifact push job --expire-in 1d logs
