Skip to content

Latest commit

 

History

History
210 lines (176 loc) · 5.02 KB

File metadata and controls

210 lines (176 loc) · 5.02 KB

harmony-systems repo is responsible for:

  1. generating tarballs of the perl dependencies (“vendor bundles”)
  2. uploading the above to an amazon s3 bucket
  3. generating several related docker images

How-To

Add perl dependencies to BMO

Adding dependencies to BMO (or bugzilla in general) involves adding them to Makefile.PL. Getting these dependencies deployed to our infrastructure is more complicated.

For each type of bundle we produce, you need to run the docker container bugzilla/PLATFORM. Currently PLATFORM is centos6 and ubuntu14. From inside the container, run the following:

source /build/env.sh
git clone --depth 1 https://github.com/bugzilla/harmomy.git
cd harmomy
cp ../cpanfile.snapshot .
$PERL Makefile.PL
make cpanfile GEN_CPANFILE_ARGS="-D bmo"
$PERL $CARTON install

After that, use ‘docker cp’ to copy build/harmomy/cpanfile and /build/harmomy/cpanfile.snapshot to bundle/PLATFORM and commit them.

Upgrade perl dependencies

This is the same as adding a dependency, except instead of “$PERL $CARTON install” you run “$PERL $CARTON upgrade”.

Configuration

# if this file ends in .yml, you should not edit it and edit circle.org instead.
version: 2

jobs:
  <<upload>>
  <<centos6>>
  <<harmony-slim>>
  <<docker-centos6>>

workflows:
  version: 2
  builders:
    jobs:
      - docker-centos6:
          <<only master>>
  bundles:
    jobs:
      - centos6:
          <<only master>>
      - harmony-slim:
          <<only master>>
          requires:
            - centos6
      - upload:
          <<only master>>
          requires:
            - centos6
filters:
  branches:
    only: master

docker jobs

harmony-slim

harmony-slim:
  working_directory: /build
  docker:
    - image: docker:17.06.1-ce
      environment:
        DOCKERHUB_REPO: bugzilla/harmony-slim
        PATH: /build/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
  steps:
    - setup_remote_docker
    - checkout
    - attach_workspace:
        at: /build/upload
    - run:
        working_directory: /build/docker/harmony-slim
        command: |
          tar -zxf /build/upload/harmony/vendor.tar.gz \
            harmony/vendor/bin \
            harmony/local \
            harmony/cpanfile \
            harmony/cpanfile.snapshot \
            harmony/LIBS.txt \
            harmony/PACKAGES.txt
          docker-build

docker-centos6

docker-centos6:
  working_directory: /build
  docker:
    - image: docker:17.06.1-ce
      environment:
        DOCKERHUB_REPO: bugzilla/centos6
        PATH: /build/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
  steps:
    - setup_remote_docker
    - checkout
    - run:
        name: build docker container
        command: |
          docker-build -f bundle/centos6/Dockerfile

bundle jobs

All the jobs below are used to build collections of the perl dependencies that harmony needs.

centos 6 job

This job creates the ‘harmony bundle, which is for use on centos 6 or RHEL 6 machines. This is what production, vagrant, CI, and so on use.

centos6:
  working_directory: /build
  docker:
    - image: centos:6.9
      environment: 
        PATH: /build/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
        NAME: centos6
  steps:
    - checkout
    - run:
        name: install rpms
        command: /build/bundle/centos6/install-rpms
    <<build_bundles>>

upload job

This job just collects vendor.tar.gzs from other jobs and uploads them to an amazon S3 bucket.

upload:
  working_directory: /build
  docker:
    - image: alpine:latest
      environment:
        S3_BUCKET: bugzilla-cartons
  steps:
    - run:
        command: |
          apk update
          apk add curl # installs ca certs
    - attach_workspace:
        at: /build/upload
    - run:
        name: install awscli
        command: |
          apk update
          apk add py-pip
          pip install awscli
    - run:
        working_directory: /build/upload
        command: |
          for file in */vendor.tar.gz; do
            aws s3 cp $file s3://$S3_BUCKET/$file;
          done

Other pieces of code

Some bits of configuration used in multiple locations

build_bundles steps

The following list of steps are used on all jobs that build vendor tarballs.

- run:
    name: copy cpanfile and cpanfile.snapshot
    command: cp bundle/$CIRCLE_JOB/cpanfile* .
- run: build-prepare
- run: build-stage1
- run: build-stage2
- run: build-vendor-bundle $NAME
- persist_to_workspace:
    root: /build/upload
    paths:
      - "*/vendor.tar.gz"
- store_artifacts:
    path: '/root/.cpanm/work/*/build.log'