Skip to content

Commit be0c1d2

Browse files
committed
Adding JIRA tickets to release
1 parent fccea40 commit be0c1d2

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

.github/workflows/create-release.yml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ env:
88
KOSLI_ORG: kosli-public
99
KOSLI_API_TOKEN: "${{ secrets.KOSLI_PUBLIC_API_TOKEN }}"
1010
KOSLI_CLI_VERSION: "2.11.8"
11+
KOSLI_ENV_STAGING: "jira-integration-example-staging"
12+
KOSLI_ENV_PROD: "jira-integration-example-prod"
13+
KOSLI_FLOW_FRONTEND: "jira-example-frontend"
14+
KOSLI_FLOW_BACKEND: "jira-example-backend"
1115
# KOSLI_DRY_RUN: true
1216
JIRA_BASE_URL: "https://kosli-team.atlassian.net"
1317
JIRA_USERNAME: ${{ secrets.KOSLI_JIRA_USERNAME }}
@@ -26,15 +30,26 @@ jobs:
2630

2731
- name:
2832
run: |
29-
set -x
3033
source scripts/lib-jira.sh
31-
current_release_json=$(get_current_release_candidate ${{ env.JIRA_PROJECT_ID }})
32-
echo "${current_release_json}" | jq .
33-
current_release=$(echo "${current_release_json}" | jq .values)
34-
echo cr=$current_release
35-
if [ "${current_release}" != "[]" ]; then
36-
echo "Release candidate already exist: ${current_release}"
37-
exit 1
38-
fi
39-
TIMESTAMP=$(date -u "+%Y-%m-%d-%H-%M-%S")
40-
create_release ${{ env.JIRA_PROJECT_ID }} ${TIMESTAMP}
34+
source scripts/lib-kosli.sh
35+
36+
# Check if a release already exists, if so we fail
37+
# CURRENT_REL_JSON=$(get_CURRENT_REL_candidate ${{ env.JIRA_PROJECT_ID }})
38+
# CURRENT_REL=$(echo "${CURRENT_REL_JSON}" | jq .values)
39+
# if [ "${CURRENT_REL}" != "[]" ]; then
40+
# echo "Release candidate already exist: ${CURRENT_REL}"
41+
# exit 1
42+
# fi
43+
44+
# Create the release and get the release ID
45+
# TIMESTAMP=$(date -u "+%Y-%m-%d-%H-%M-%S")
46+
# CREATE_RESULT_JSON=$(create_release ${{ env.JIRA_PROJECT_ID }} ${TIMESTAMP})
47+
# RELEASE_ID=$(echo "${CREATE_RESULT_JSON}" | jq .id)
48+
RELEASE_ID=10099
49+
50+
# Add jira tickets to release
51+
JIRA_KEYS=$(get_issue_keys_between_staging_and_prod)
52+
echo "Found issues: ${JIRA_KEYS}"
53+
for JIRA_KEY in ${JIRA_KEYS}; do
54+
add_issue_to_release ${JIRA_KEY} ${RELEASE_ID}
55+
done

scripts/lib-jira.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,14 @@ function create_release
4848
{
4949
local -r projectId=$1; shift
5050
local -r releaseName=$1; shift
51+
local -r startDate=$(date -u "+%Y-%m-%d")
5152

5253
local -r url="${JIRA_BASE_URL}/rest/api/3/version"
5354
local -r data='{
54-
"description": "An excellent version",
55+
"description": "Release '${releaseName}'",
5556
"name": "'${releaseName}'",
5657
"projectId": '${projectId}',
57-
"approvers": [{
58-
"accountId": "'${approverId}'"
59-
}]
58+
"startDate": "'${startDate}'"
6059
}'
6160
loud_curl_jira POST "${url}" "${data}"
6261
}

0 commit comments

Comments
 (0)