---
# Copyright 2019, SUSE LINUX GmbH.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- project:
    check:
      jobs:
        - openstack-helm-images-build-ceph-config-helper
        - openstack-helm-images-build-ceph-daemon
        - openstack-helm-images-build-ceph-utility
    gate:
      jobs:
        - openstack-helm-images-upload-ceph-config-helper
        - openstack-helm-images-upload-ceph-daemon
        - openstack-helm-images-upload-ceph-utility
    promote:
      jobs:
        - openstack-helm-images-promote-ceph-config-helper
        - openstack-helm-images-promote-ceph-daemon
        - openstack-helm-images-promote-ceph-utility
    periodic-weekly:
      jobs:
        - openstack-helm-images-build-ceph-config-helper
        - openstack-helm-images-build-ceph-daemon
        - openstack-helm-images-build-ceph-utility

- job:
    name: openstack-helm-images-build-ceph-common
    parent: openstack-helm-images-build
    abstract: true
    vars:
      currentdate: "{{ now(utc=True,fmt='%Y%m%d') }}"
      docker_images:
        - &ceph_image
          dockerfile: Dockerfile.ubuntu
          build_args:
            - "FROM='ubuntu:jammy'"
            - "CEPH_RELEASE='squid'"
            - "CEPH_RELEASE_TAG='19.2.1-1~jammy'"
            - "CEPH_REPO='http://mirror.mirantis.com/acicd/ceph-19.2.1.patch1/jammy'"
            - "CEPH_KEY='http://mirror.mirantis.com/acicd/ceph-19.2.1.patch1/jammy/release.asc'"
          tags:
            - latest-ubuntu_jammy
            - "ubuntu_jammy_19.2.1-1-{{ currentdate }}"
    files: &ceph_files
      - ceph.*
      - zuul.d/ceph.*

- job:
    name: openstack-helm-images-build-ceph-config-helper
    parent: openstack-helm-images-build-ceph-common
    description: Build ceph-config-helper images
    vars: &ceph-config-helper_vars
      currentdate: "{{ now(utc=True,fmt='%Y%m%d') }}"
      docker_images:
        - <<: *ceph_image
          context: ceph-config-helper
          repository: openstackhelm/ceph-config-helper

- job:
    name: openstack-helm-images-upload-ceph-config-helper
    parent: openstack-helm-images-upload
    description: Build and upload ceph-config-helper images
    vars: *ceph-config-helper_vars
    files: *ceph_files

- job:
    name: openstack-helm-images-promote-ceph-config-helper
    parent: openstack-helm-images-promote
    description: Promote a previously published ceph-config-helper image to latest.
    vars: *ceph-config-helper_vars
    files: *ceph_files

- job:
    name: openstack-helm-images-build-ceph-daemon
    parent: openstack-helm-images-build-ceph-common
    description: Build ceph-daemon images
    vars: &ceph-daemon_vars
      currentdate: "{{ now(utc=True,fmt='%Y%m%d') }}"
      docker_images:
        - <<: *ceph_image
          context: ceph-daemon
          repository: openstackhelm/ceph-daemon

- job:
    name: openstack-helm-images-upload-ceph-daemon
    parent: openstack-helm-images-upload
    description: Build and upload ceph-daemon images
    vars: *ceph-daemon_vars
    files: *ceph_files

- job:
    name: openstack-helm-images-promote-ceph-daemon
    parent: openstack-helm-images-promote
    description: Promote a previously published ceph-daemon image to latest.
    vars: *ceph-daemon_vars
    files: *ceph_files

- job:
    name: openstack-helm-images-build-ceph-utility
    parent: openstack-helm-images-build-ceph-common
    description: Build ceph-utility images
    vars: &ceph-utility_vars
      currentdate: "{{ now(utc=True,fmt='%Y%m%d') }}"
      docker_images:
        - <<: *ceph_image
          context: ceph-utility
          repository: openstackhelm/ceph-utility

- job:
    name: openstack-helm-images-upload-ceph-utility
    parent: openstack-helm-images-upload
    description: Build and upload ceph-utility images
    vars: *ceph-utility_vars
    files: *ceph_files

- job:
    name: openstack-helm-images-promote-ceph-utility
    parent: openstack-helm-images-promote
    description: Promote a previously published ceph-utility image to latest.
    vars: *ceph-utility_vars
    files: *ceph_files