Skip to content

Commit

Permalink
Merge pull request #649 from snyk/feat/add-bearer-scheme-option-for-jira
Browse files Browse the repository at this point in the history
feat: add jira bearer auth flavor
  • Loading branch information
aarlaud authored Oct 18, 2023
2 parents 67b1ac9 + b37a567 commit 1d60790
Show file tree
Hide file tree
Showing 3 changed files with 248 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,34 @@ workflows:
- notify-slack-on-failure
<<: *filter-tags-only

- build-and-save-docker-image:
name: Build jira bearer auth UBI image
context:
- snyk-bot-slack
- team-broker-snyk
requires:
- Push base UBI image
additional_arguments: "--build-arg BASE_IMAGE=snyk/broker:${CIRCLE_TAG/v/''}-base-rhel-ubi --build-arg BROKER_TYPE=jira-bearer-auth"
dockerfile: dockerfiles/Dockerfile.ubi
project_name: rhel-ubi-jira-bearer-auth
post-steps:
- notify-slack-on-failure
<<: *filter-tags-only
- tag-and-push-docker-image:
name: Push jira bearer auth UBI image
context:
- snyk-bot-slack
- team-broker-docker-hub
- team-broker-snyk
requires:
- Build jira bearer auth UBI image
image_name: snyk/broker
image_tag: rhel-ubi-jira-bearer-auth
project_name: rhel-ubi-jira-bearer-auth
post-steps:
- notify-slack-on-failure
<<: *filter-tags-only

- build-and-save-docker-image:
name: Build nexus UBI image
context:
Expand Down Expand Up @@ -1092,6 +1120,34 @@ workflows:
post-steps:
- notify-slack-on-failure
<<: *filter-tags-only

- build-and-save-docker-image:
name: Build jira bearer auth image
context:
- snyk-bot-slack
- team-broker-snyk
requires:
- Push base image
additional_arguments: "--build-arg BASE_IMAGE=snyk/broker:${CIRCLE_TAG/v/''}-base --build-arg BROKER_TYPE=jira-bearer-auth"
dockerfile: dockerfiles/Dockerfile
project_name: jira-bearer-auth
post-steps:
- notify-slack-on-failure
<<: *filter-tags-only
- tag-and-push-docker-image:
name: Push jira bearer auth image
context:
- snyk-bot-slack
- team-broker-docker-hub
- team-broker-snyk
requires:
- Build jira bearer auth image
image_name: snyk/broker
image_tag: jira-bearer-auth
project_name: jira-bearer-auth
post-steps:
- notify-slack-on-failure
<<: *filter-tags-only

- build-and-save-docker-image:
name: Build nexus image
Expand Down Expand Up @@ -1373,6 +1429,34 @@ workflows:
- notify-slack-on-failure
<<: *filter-tags-only

- build-and-save-docker-image:
name: Build jira bearer auth image (nlatest)
context:
- snyk-bot-slack
- team-broker-snyk
requires:
- Push base image (nlatest)
additional_arguments: "--build-arg BASE_IMAGE=snyk/broker:${CIRCLE_TAG/v/''}-base-nlatest --build-arg BROKER_TYPE=jira-bearer-auth"
dockerfile: dockerfiles/Dockerfile
project_name: jira-bearer-auth-nlatest
post-steps:
- notify-slack-on-failure
<<: *filter-tags-only
- tag-and-push-docker-image:
name: Push jira bearer auth image (nlatest)
context:
- snyk-bot-slack
- team-broker-docker-hub
- team-broker-snyk
requires:
- Build jira bearer auth image (nlatest)
image_name: snyk/broker
image_tag: jira-bearer-auth-nlatest
project_name: jira-bearer-auth-nlatest
post-steps:
- notify-slack-on-failure
<<: *filter-tags-only

- build-and-save-docker-image:
name: Build nexus image (nlatest)
context:
Expand Down
27 changes: 27 additions & 0 deletions client-templates/jira-bearer-auth/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# your unique broker identifier
BROKER_TOKEN=<broker-token>

# your personal password or API token to your Jira Server account
JIRA_PAT=<jira-pat>

# your Jira Server hostname, i.e. jira.yourdomain.com
JIRA_HOSTNAME=jira.yourdomain.com

# the url of your broker client (including scheme and port)
# BROKER_CLIENT_URL=

# Jira validation url, checked by broker client systemcheck endpoint
BROKER_CLIENT_VALIDATION_URL=https://$JIRA_HOSTNAME/rest/api/2/myself

# Jira Bearer auth creds
BROKER_CLIENT_VALIDATION_AUTHORIZATION_HEADER="Bearer $JIRA_PAT"

# The URL of the Snyk broker server
BROKER_SERVER_URL=https://broker.snyk.io

# the fine detail accept rules that allow Snyk to make API requests to your
# Jira instance
ACCEPT=accept.json

# The path for the broker's internal healthcheck URL. Must start with a '/'.
BROKER_HEALTHCHECK_PATH=/healthcheck
137 changes: 137 additions & 0 deletions client-templates/jira-bearer-auth/accept.json.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
{
"public":
[],
"private":
[
{
"//": "get jira server info",
"method": "GET",
"path": "/rest/api/2/serverInfo",
"origin": "https://${JIRA_HOSTNAME}",
"auth": {
"scheme": "bearer",
"token": "${JIRA_PAT}"
}
},
{
"//": "identify user",
"method": "GET",
"path": "/rest/api/2/myself",
"origin": "https://${JIRA_HOSTNAME}",
"auth": {
"scheme": "bearer",
"token": "${JIRA_PAT}"
}
},
{
"//": "used to get a list of all Jira projects",
"method": "GET",
"path": "/rest/api/2/project",
"origin": "https://${JIRA_HOSTNAME}",
"auth": {
"scheme": "bearer",
"token": "${JIRA_PAT}"
},
"valid": [
{
"queryParam": "expand",
"values": [
"issueTypes"
]
}
]
},
{
"//": "used to get a Jira project",
"method": "GET",
"path": "/rest/api/2/project/:project",
"origin": "https://${JIRA_HOSTNAME}",
"auth": {
"scheme": "bearer",
"token": "${JIRA_PAT}"
}
},
{
"//": "used to get createmeta for a jira project & issueType",
"method": "GET",
"path": "/rest/api/2/issue/createmeta",
"origin": "https://${JIRA_HOSTNAME}",
"auth": {
"scheme": "bearer",
"token": "${JIRA_PAT}"
}
},
{
"//": "used to get createmeta for a jira project & issueType version 9 and above",
"method": "GET",
"path": "/rest/api/2/issue/createmeta/:project/issuetypes/:issue",
"origin": "https://${JIRA_HOSTNAME}",
"auth": {
"scheme": "bearer",
"username": "${JIRA_USERNAME}",
"token": "${JIRA_PAT}"
}
},
{
"//": "used to get issue type information for version 9 or above",
"method": "GET",
"path": "/rest/api/2/issuetype/:issuetype",
"origin": "https://${JIRA_HOSTNAME}",
"auth": {
"scheme": "bearer",
"username": "${JIRA_USERNAME}",
"token": "${JIRA_PAT}"
}
},
{
"//": "used to get jira issue",
"method": "GET",
"path": "/rest/api/2/issue/:issue",
"origin": "https://${JIRA_HOSTNAME}",
"auth": {
"scheme": "bearer",
"token": "${JIRA_PAT}"
}
},
{
"//": "used to create jira issue",
"method": "POST",
"path": "/rest/api/2/issue",
"origin": "https://${JIRA_HOSTNAME}",
"auth": {
"scheme": "bearer",
"token": "${JIRA_PAT}"
}
},
{
"//": "used to create jira issue link",
"method": "POST",
"path": "/rest/api/2/issue/:issue/remotelink",
"origin": "https://${JIRA_HOSTNAME}",
"auth": {
"scheme": "bearer",
"token": "${JIRA_PAT}"
}
},
{
"//": "used to get assignable users",
"method": "GET",
"path": "/rest/api/2/user/assignable/search",
"origin": "https://${JIRA_HOSTNAME}",
"auth": {
"scheme": "bearer",
"token": "${JIRA_PAT}"
}
},
{
"//": "used to get available components",
"method": "GET",
"path": "/rest/api/2/project/:project/components",
"origin": "https://${JIRA_HOSTNAME}",
"auth": {
"scheme": "bearer",
"token": "${JIRA_PAT}"
}
}
]
}

0 comments on commit 1d60790

Please sign in to comment.