Categorygithub.com/frantjc/jenkins-job-resource
modulepackage
0.1.1
Repository: https://github.com/frantjc/jenkins-job-resource.git
Documentation: pkg.go.dev

# README

jenkins-job-resource CI godoc goreportcard license

A Concourse resource for Jenkins jobs.

Example

resource_types:
  - name: jenkins-job-resource
    type: registry-image
    source:
      repository: ghcr.io/frantjc/jenkins-job-resource
      tag: latest
resources:
  - name: my-jenkins-job
    type: jenkins-job-resource
    source:
jobs:
  - name: some-job
    plan:
      - put: my-jenkins-job
        params:
          cause: some-job in Concourse caused this build
          build_params:
            foo: bar
  - name: another-job
    plan:
      - get: my-jenkins-job

Source Configuration

ParameterRequiredExampleDescription
urlyeshttps://my-jenkins.comthe base url for a Jenkins deployment
jobyesthe job name in the Jenkins deployment at the given url
tokenfor putsee below (1)the Authentication Token for the given job
usernameunknown, but likelya username that can be used to authorize with the given Jenkins url
loginunknown, but likelyeither the password or an api token associated with the given username

Note: if login is set, then surely username must be set to a corresponding username for it to have any effect. It is unknown if a Jenkins deployment can be configured such that both username and login are not required

build-triggers

(1) the above can be found at $YOUR_JENKINS > $YOUR_JOB > Configure

Behavior

check

Produces new versions for all builds (after the last version) ordered by the build number

in

ParameterRequiredExampleDescription
accept_resultsno[SUCCESS]array of acceptable results of the build. The step will fail if none match. Empty arrays are ignored
regexpno[path/to/output.*]limits downloaded artifacts to only those that match one of the given patterns. Hidden files (ex: .git) will be ignored
skip_downloadnowhether or not to download any of the artifacts at all. Overrides regexp. Default false

Optionally gets the specified artifacts outputted by the most recent build

Metadata is made available at ./.metadata/name. ex:

$ cat ./my-jenkins-job/.metadata/result
SUCCESS

out

ParameterRequiredExampleDescription
causenothe cause of the build being triggered. Default caused by $ATC_EXTERNAL_URL/builds/$BUILD_ID
cause_filenopath/to/causepath to a file containing the cause of the build being triggered
descriptionnothe description of the build. Default build triggered by $ATC_EXTERNAL_URL/builds/$BUILD_ID
description_filenopath/to/descriptionpath to a file containing the description of the build
build_paramsnoany objectname-value pairs that will be passed to the build as build parameters

Triggers a new build of the target job and gets the result

developing

  • make is recommended - version 3.81 is tested
  • golang is required - version 1.18.x or above is required for generics
  • docker is required - version 20.10.x is tested

# Packages

No description provided by the author
No description provided by the author

# Structs

CheckRequest is the JSON object that Concourse passes to /opt/resource/check through stdin.
GetParams are additional parameters that can be passed to this Concourse Resource Type during a get step.
InRequest is the JSON object that Concourse passes to /opt/resource/in through stdin.
InResponse is the JSON object that we pass back to Concourse through stdout from /opt/resource/in.
Metadata is the object which is passed in array form to Concourse through stdout from /opt/resource/out and /opt/resource/in to provide additional information about the Version.
OutRequest is the JSON object that Concourse passes to /opt/resource/out through stdin.
OutResponse is the JSON object that we pass back to Concourse through stdout from /opt/resource/out.
PutParams are additional parameters that can be passed to this Concourse Resource Type during a put step.
Source is the JSON (yaml) object configured under the resources array in a Concourse pipeline.
Version is the JSON object that is passed to and from Concourse.

# Type aliases

CheckResponse is the JSON object that we pass back to Concourse through stdout from /opt/resource/check.