Skip to content

project-anacapa/jenkins-api-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jenkins-api-proto

API

The functionality of this API is encapsulated in the Jenkins module.

The main class exposed right now is the 'lab' class.

# to create a new lab instance
lab = Jenkins::Lab.new(
  :git_provider_domain => "github.com",
  :course_org => "ucsb-cs-test-org-1",
  :credentials_id => "github.com-gareth-machine-user",
  :lab_name => "lab00"
  )

Lab methods

  • lab.makeGraderAndAssignentIfNotExist will check that jobs for this assignment have been created (creating them if they do not exist). You MUST call this before attempting to grade a student submission or update an assignment from the professors definition repository.
  • assignment_job_name is an attribute accessor returning the name of the job for updating the assignment ( NOTE: this job does not necessarily exist, you must first trigger makeGraderAndAssignentIfNotExist to trigger its creation)
  • grader_job_name is an attribute accessor returning the name of the job for grading student submissions. To build this you must pass in an enviornment variable containnig the student's github profile as per https://github.com/project-anacapa/anacapa-jenkins-lib/blob/master/jobs/grader.groovy. The name of the enviornment variable of interest is 'github_user'

Jenkins Configuration

  • TODO: move this to a more appropriate location
  • Plugins
    • install Job DSL
    • install Rebuilder
    • install Copy Artifact
    • install Environment Injector Plugin
  • Manage Jenkins -> Configure System -> Click add Global Pipeline Library
  • Additional Steps for Development
    • Go to Security -> Enable Script Security for Job DSL
      • Uncheck the setting to avoid annoying confirmation dialogs
    • Go to Manage Nodes and edit the settings for 'master' and add the 'submit' label
      • this is because in production you would add worker slaves with ssh credentials and the 'submit' label but this is entirely unnecessary for development.
  • Restart Jenkins and you should be good to go!

Jenkins Jobs Setup

  • Create Job -> Free Style Project
    • name: anacapa-jenkins-lib (note this job will bootstrap the construction of other jobs)
    • turn on Build Enviornment -> 'delete workspace before build' setting in the job setup
    • build -> add build step -> Process Job DSLs
      • look on file system
      • DLS Scripts: jobs/standaloneSetupAssignment.groovy
    • save changes!
    • run the job
      • you should see a new job 'AnacapaGrader-setupAssignment'

About

Ruby API for jenkins

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages