CopyPastor

Detecting plagiarism made easy.

Score: 2; Reported for: String similarity, Exact paragraph match Open both answers

Possible Plagiarism

Reposted on 2020-02-22
by Arun Sangal

Original Post

Original - Posted on 2020-02-22
by Arun Sangal



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Not sure! why JIRA doesn't provide a very simple Rest Endpoint to just spit all sprints info. Why I have to deal with board/boardID to find sprints in that board, why I have to iterate over all sprints.
I'm administrator user and still hitting some of the sprint # gives me, `Sprint does not exist`.
Anyways, here's a work-around script.

#!/bin/bash
JIRA_URL="http://my_jira_server:8080"
users_sprint_limit_cmd_line_arg="$1" # First parameter passed to the script is a NUMBER (for how many sprints a user wants to iterate over. ## I know!! it's a work-around for dealing with "Sprint does not exist" and ## becasue there's no shitty direct JIRA Rest API that exist, to query JIRA server, to spit all SPRINTS with info (start/end date) in just one call.
## You can use API token (or base64 hash). I'm just going rouge here. user="a_user_user_who_can_read_any_sprint_or_serviceuser_or_admin" pass="D00M4u!" ## Set build number variable b_no=${BUILD_NUMBER:="999999"} ## At the end, you'll have a Temp file will store all sprints info, Valid will contain only valid sprints. temp_sprint_file="/tmp/all_sprints_startdates_${b_no}_temp.txt" valid_sprint_file="/tmp/all_sprints_startdates_${b_no}.txt"
## Clean files rm ${temp_sprint_file} ${valid_sprint_file} || true; ## Sprint counter sprint_no=1 result="ToBeSet" ## Iterate over all sprints and find their start/stop dates. ## -- This is one-odd way to find sprint's start/end dates, but it works!! ## -- A user can pass a larger value in while condition "-lt value" via cmd line 1st param. while [[ $sprint_no -lt ${users_sprint_limit_cmd_line_arg} ]]; do ## assumes 'jq' is installed. --OR run: sudo yum install jq ## -------------------------- result="$(curl -s -u $user:$pass -X GET -H 'Content-Type: application/json' "${JIRA_URL}/rest/agile/1.0/sprint/${sprint_no}" | \ jq | \ egrep "name|startDate|endDate" | \ cut -d'"' -f4 | \ sed "s/T[0-9][0-9]:[0-9][0-9].*$//" | \ tr '\012' ',' | \ sed "s/,$//")"; echo "${result}" >> ${temp_sprint_file} ((sprint_no++)); done ## Find valid sprints which have valid start/end dates. grep "[A-Za-z],[0-9].*,[0-9]" ${temp_sprint_file} > ${valid_sprint_file}; echo -e "\n\n-- Sprints and Start/End Date file is available here: ${valid_sprint_file}\n\n"

Running `cat` command on this file will give you, something like:
1 Trumpy Trump,2019-01-09,2019-01-23 2 Magical Modi,2019-01-18,2019-02-01
Where, you can add a line in the above script, to use it as a pure CSV file by having a header line i.e. `Sprint_Name,Sprint_Start_Date,Sprint_End_Date`, I just didn't do that as my use case was to use just this file as a reference file.
A related post regarding dates: https://stackoverflow.com/questions/60218439/bash-how-to-find-no-of-days-considering-only-network-business-days-betwe
Not sure! why JIRA doesn't provide a very simple Rest Endpoint to just spit all sprints info. Why I have to deal with board/boardID to find sprints in that board, why I have to iterate over all sprints.
I'm administrator user and still hitting some of the sprint # gives me, `Sprint does not exist`.
Anyways, here's a work-around script.

#!/bin/bash
JIRA_URL="http://my_jira_server:8080"
users_sprint_limit_cmd_line_arg="$1" # First parameter passed to the script is a NUMBER (for how many sprints a user wants to iterate over. ## I know!! it's a work-around for dealing with "Sprint does not exist" and ## becasue there's no shitty direct JIRA Rest API that exist, to query JIRA server, to spit all SPRINTS with info (start/end date) in just one call.
## You can use API token (or base64 hash). I'm just going rouge here. user="a_user_user_who_can_read_any_sprint_or_serviceuser_or_admin" pass="D00M4u!" ## Set build number variable b_no=${BUILD_NUMBER:="999999"} ## At the end, you'll have a Temp file will store all sprints info, Valid will contain only valid sprints. temp_sprint_file="/tmp/all_sprints_startdates_${b_no}_temp.txt" valid_sprint_file="/tmp/all_sprints_startdates_${b_no}.txt"
## Clean files rm ${temp_sprint_file} ${valid_sprint_file} || true; ## Sprint counter sprint_no=1 result="ToBeSet" ## Iterate over all sprints and find their start/stop dates. ## -- This is one-odd way to find sprint's start/end dates, but it works!! ## -- A user can pass a larger value in while condition "-lt value" via cmd line 1st param. while [[ $sprint_no -lt ${users_sprint_limit_cmd_line_arg} ]]; do ## assumes 'jq' is installed. --OR run: sudo yum install jq ## -------------------------- result="$(curl -s -u $user:$pass -X GET -H 'Content-Type: application/json' "${JIRA_URL}/rest/agile/1.0/sprint/${sprint_no}" | \ jq | \ egrep "name|startDate|endDate" | \ cut -d'"' -f4 | \ sed "s/T[0-9][0-9]:[0-9][0-9].*$//" | \ tr '\012' ',' | \ sed "s/,$//")"; echo "${result}" >> ${temp_sprint_file} ((sprint_no++)); done ## Find valid sprints which have valid start/end dates. grep "[A-Za-z],[0-9].*,[0-9]" ${temp_sprint_file} > ${valid_sprint_file}; echo -e "\n\n-- Sprints and Start/End Date file is available here: ${valid_sprint_file}\n\n"

Running `cat` command on this file will give you, something like:
1 Trumpy Trump,2019-01-09,2019-01-23 2 Magical Modi,2019-01-18,2019-02-01
Where, you can add a line in the above script, to use it as a pure CSV file by having a header line i.e. `Sprint_Name,Sprint_Start_Date,Sprint_End_Date`, I just didn't do that as my use case was to use just this file as a reference file.
A related post regarding dates: https://stackoverflow.com/questions/60218439/bash-how-to-find-no-of-days-considering-only-network-business-days-betwe

        
Present in both answers; Present only in the new answer; Present only in the old answer;