sul-dlss/SearchWorks

View on GitHub
Jenkinsfile-Folio-Update

Summary

Maintainability
Test Coverage
pipeline {
  agent any

  triggers {
      cron('H(5-20) 5 * * *')
  }

  environment {
    OKAPI_URL = credentials('OKAPI_PROD_URL')
  }

  stages {
    stage('harvest') {
      steps {
        checkout scm

        sshagent (['sul-devops-team']){
          sh '''#!/bin/bash -l
          export PATH=/ci/home/bin:$PATH
          export HUB_CONFIG=/ci/home/config/hub

          # Load RVM
          rvm use 3.2.2@searchworks --create
          gem install bundler

          bundle install --without production

          # Harvest
          bin/rake folio:update_types_cache || exit 1

          # Make a PR
          git checkout -B folio-policies-update
          git add config/folio
          git commit -m "Update FOLIO types" &&
          git push git@github.com:sul-dlss/SearchWorks.git folio-policies-update &&
          hub pull-request -f -m "Update FOLIO types" --base main
          echo 'Done!'
          '''
        }
      }
    }
  }
}