---
- scm:
    name: build_fpm_package
    scm:
        - git:
            url: https://github.com/alphagov/packager
            branches:
              - master

- job:
    name: build_fpm_package
    display-name: Build fpm package
    project-type: freestyle
    properties:
        - build-discarder:
            days-to-keep: 30
            artifact-num-to-keep: 5
        - github:
            url: https://github.com/alphagov/packager/
    scm:
      - build_fpm_package
    parameters:
        - string:
            name: RECIPE
            description: The name of an fpm-cookery recipe
        - string:
            name: DISTRO
            description: Ubuntu distribution to target (trusty, xenial)
            default: trusty
    builders:
        - shell: |
            cd fpm/
            ./container-build.sh
    publishers:
        - archive:
            artifacts: 'build/*.deb'

---
- scm:
    name: build_fpm_package
    scm:
        - git:
            url: https://github.com/alphagov/packager
            branches:
              - master
            wipe-workspace: true

- job:
    name: build_fpm_package
    display-name: Build fpm package
    project-type: freestyle
    properties:
        - build-discarder:
            days-to-keep: 30
            artifact-num-to-keep: 5
        - github:
            url: https://github.com/alphagov/packager/
    scm:
      - build_fpm_package
    parameters:
        - string:
            name: RECIPE
            description: The name of an fpm-cookery recipe
        - string:
            name: DISTRO
            description: Ubuntu distribution to target (trusty, xenial)
            default: trusty
    builders:
        - shell: |
            cd fpm/
            ./container-build.sh
    publishers:
        - archive:
            artifacts: 'fpm/recipes/*/pkg/*.deb'

Fix the build_fpm_manager job config
Fix the build_fpm_manager job config

# Context
This job runs in a docker container that mounts the local system for sharing
the debian package. Archiving the *.deb files (artifacts) with "build/*.deb"
doesn't work - I assume this was a remnant of the pre-docker job config. The
debian is actually available locally with the "fpm" root and on the container
with the "build" root. In addition to this the workspace is not cleared. In
combination this results in the job failing (as it can't clear the workspace).
It also means that the created package is not archived by Jenkins.

# Decision
Wipe the workspace before starting and make sure the debian files are archived
using the Jenkins job config.

Co-authored-by: Conor Glynn <416485996da9123c1b84095b547f3d3f9b9a7705@digital.cabinet-office.gov.uk>
