https://github.com/fourdollars/jira-resource
Concourse CI resource to interact with Jira API
https://github.com/fourdollars/jira-resource
concourse-ci-resource jira
Last synced: 28 days ago
JSON representation
Concourse CI resource to interact with Jira API
- Host: GitHub
- URL: https://github.com/fourdollars/jira-resource
- Owner: fourdollars
- License: mit
- Created: 2023-03-29T05:53:07.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-16T05:02:49.000Z (9 months ago)
- Last Synced: 2025-02-12T18:43:24.786Z (3 months ago)
- Topics: concourse-ci-resource, jira
- Language: Shell
- Homepage: https://fourdollars.github.io/
- Size: 21.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/fourdollars/jira-resource/) [](https://opensource.org/licenses/MIT) [](https://www.gnu.org/software/bash/)  [](https://hub.docker.com/r/fourdollars/jira-resource/)
# jira-resource
[Concourse CI](https://concourse-ci.org/)'s Jira resource to interact with [Jira REST APIs](https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/).## Config
### Resource Type
```yaml
resource_types:
- name: jira
type: registry-image
source:
repository: fourdollars/jira-resource
tag: latest
```or
```yaml
resource_types:
- name: jira
type: registry-image
source:
repository: ghcr.io/fourdollars/jira-resource
tag: latest
```### Resource
* url: **Required**
* user: **Required**
* token: **Required**
* resource: **Required**```yaml
resources:
- name: issue
icon: jira
type: jira
check_every: 15m
source:
url: https://jira.atlassian.com/rest/api/latest/
user: username
token: password
resource: issue/JRA-9
- name: search-by-label
icon: jira
type: jira
check_every: 15m
source:
url: https://jira.atlassian.com/rest/api/latest/
user: username
token: password
resource: "search?jql=project=DEVOPS%20AND%20labels%20IN%20(\"Concourse-CI\")&maxResults=50"
- name: search-by-label
icon: jira
type: jira
check_every: 15m
source:
url: https://jira.atlassian.com/rest/api/latest/
user: username
token: password
resource: "search?jql=project=DEVOPS%20AND%20labels%20IN%20(\"Concourse-CI\")&maxResults=50"
- name: all-issues
icon: jira
type: jira
check_every: 15m
source:
url: https://jira.atlassian.com/rest/api/latest/
user: username
token: password
fetch: issues
resource: "search?jql=project=DEVOPS"
```
### check step```yaml
- get: issue
trigger: true
```
```shell
# It acts like the following commands.
$ curl -fsSL --user "username:password" https://jira.atlassian.com/rest/api/latest/issue/JRA-9 > payload.json
$ digest="sha256:$(jq -S -M < payload.json | sha256sum | awk '{print $1}')"
```### get step
```yaml
- get: issue
trigger: true
```
```shell
# It acts like the following commands.
$ cd /tmp/build/get
$ curl -fsSL --user "username:password" https://jira.atlassian.com/rest/api/latest/issue/JRA-9 > payload.json
```### put step
```yaml
- put: issue
params:
json: output/data.json
```
```shell
# It acts like the following commands.
$ cd /tmp/build/put
$ curl -fsSL --user "username:password" -X PUT --data @output/data.json -H "Content-Type: application/json" https://jira.atlassian.com/rest/api/latest/issue/JRA-9 > payload.json
```### Job Example
```yaml
jobs:
- name: check-jira-issue
plan:
- get: issue
trigger: true
- task: check
config:
platform: linux
image_resource:
type: registry-image
source:
repository: alpine
tag: latest
inputs:
- name: issue
run:
path: sh
args:
- -exc
- |
apk add --quiet --no-progress jq
jq -r .self < issue/payload.json
- name: check-jira-search
plan:
- get: search-by-label
trigger: true
- task: check
config:
platform: linux
image_resource:
type: registry-image
source:
repository: alpine
tag: latest
inputs:
- name: search-by-label
run:
path: sh
args:
- -exc
- |
apk add --quiet --no-progress jq
jq -r ".issues | .[] | .self, .key, .fields.summary" < search-by-label/payload.json
- name: check-all-issues
plan:
- get: all-issues
trigger: true
- task: check
config:
platform: linux
image_resource:
type: registry-image
source:
repository: alpine
tag: latest
inputs:
- name: all-issues
run:
path: sh
args:
- -exc
- |
apk add --quiet --no-progress jq
jq -r ".issues | .[] | .self, .key, .fields.summary" < all-issues/payload.json
- name: comment-on-jira-issue
plan:
- get: issue
- task: comment
config:
platform: linux
image_resource:
type: registry-image
source:
repository: alpine
tag: latest
inputs:
- name: issue
outputs:
- name: output
run:
path: sh
args:
- -exc
- |
apk add --quiet --no-progress jq
SELF=$(jq -r .self < issue/payload.json)
mkdir -p output
cat > output/data.json <