# Auto generated by ./tcwg/generate-yamlfiles.sh from tcwg-update-source-caches.yaml.in and tcwg-update-source-caches/tcwg-update-bmk_ref.def. Do not edit.
#BEGIN: tcwg/default.yaml.inc
# -*- mode: Yaml -*-

- property:
    name: default-properties
    properties:
      - authorization:
          anonymous:
            - job-read
            - job-extended-read
          everyone-flat:
            - job-build
            - job-cancel
      - build-discarder:
          days-to-keep: 20

- scm:
    name: jenkins-scripts
    scm:
      - git:
          url: https://gitlab.com/LinaroLtd/tcwg/jenkins-scripts.git
          refspec: +refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/changes/*
          branches:
            - $scripts_branch
          basedir: jenkins-scripts
          skip-tag: true
          reference-repo: /home/tcwg-buildslave/snapshots-ref/jenkins-scripts.git
          wipe-workspace: false
          clean:
            before: true
          prune: true

#END:   tcwg/default.yaml.inc

- job:
    name: tcwg-update-bmk_ref
    project-type: freestyle
    defaults: global
    properties:
      - default-properties
    parameters:
        - bool:
            name: generate_abe
            default: false
            description: 'Generate ABE snapshots'
        - bool:
            name: generate_bmk
            default: true
            description: 'Generate benchmark source cache'
        - bool:
            name: generate_misc
            default: false
            description: 'Generate misc file'
        - bool:
            name: update_abe_git
            default: true
            description: 'Update Git repos'
        - bool:
            name: verbose
            default: true
            description: 'Enable verbose output'
        - string:
            name: scripts_branch
            default: refs/remotes/origin/master
            description: 'Scripts revision to use'
        - string:
            name: abe_branch
            default: tested
            description: 'Abe revision to use'
        - string:
            name: distro
            default: default
            description: 'Docker image tag to use'
    disabled: false
    concurrent: false
    node: tcwg-bmk-bkp-01
    display-name: 'TCWG CCC Update bmk_ref cache on TCWG machines'
    triggers:
        - timed: '@weekly'
    scm:
      - jenkins-scripts
    wrappers:
        - timeout:
            timeout: 600
        - timestamps
        - ssh-agent-credentials:
            users:
                - 'tcwg-benchmark'
        - build-name:
            name: '#${BUILD_NUMBER}'
    builders:
        - shell: |
            #!/bin/bash
            set -ex

            new_cache=$(mktemp -d)
            trap "rm -rf $new_cache" EXIT
            cache_dir=/home/shared/git
            sudo mkdir -p $cache_dir
            sudo chown -R $USER:tcwg-infra $cache_dir
            # Use previous cache to speed up re-generation.
            rsync -a --del $cache_dir/ $new_cache/
            ./jenkins-scripts/tcwg-generate-source-cache.sh \
              --cache_dir "$new_cache" \
              --generate_abe "$generate_abe" \
              --generate_bmk "$generate_bmk" \
              --generate_misc "$generate_misc" \
              --update_abe_git "$update_abe_git" \
              --verbose "$verbose" \
              --abe_branch "$abe_branch"
            rsync -a --del $new_cache/ $cache_dir/
        - trigger-builds:
            - project: tcwg-buildslave-command
              predefined-parameters: |
                command=set -ex; cache_dir=/home/shared/git; sudo mkdir -p $cache_dir; sudo chown -R $USER:tcwg-infra $cache_dir; rsync -az --del bkp-01.tcwglab:$cache_dir/ $cache_dir/
                displayname=bmk_ref
              parameter-factories:
                - factory: allnodesforlabel
                  name: nodes
                  node-label: tcwg-bmk-hw
                  ignore-offline-nodes: false
              block: false
    publishers:
        - email-ext:
            recipients: tcwg-validation@linaro.org
            aborted: true

# checksum: 525f6df3334c2f18ac0ed4415dff45fe
