diff --git a/.github/workflows/backstage.yml b/.github/workflows/backstage.yml new file mode 100644 index 0000000..575a8d5 --- /dev/null +++ b/.github/workflows/backstage.yml @@ -0,0 +1,21 @@ +name: Backstage Daily JIRA Status + +on: + push: + paths: + - 'backstage/**' + # Trigger on a cron schedule (every weekday at 4:00 PM IST) + schedule: + - cron: '30 10 * * 1-5' # Adjusted for 4:00 PM IST in UTC + workflow_dispatch: # Allow manual triggering of the workflow + +jobs: + run-script: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Run Bash Script + run: bash backstage/team-backstage.sh ${{ secrets.PERSONAL_SLACK_HOOK }} \ No newline at end of file diff --git a/.github/workflows/devconsole.yml b/.github/workflows/devconsole.yml index f6d00ef..b21961f 100644 --- a/.github/workflows/devconsole.yml +++ b/.github/workflows/devconsole.yml @@ -2,8 +2,11 @@ name: ODC Daily JIRA Status on: push: - branches: - - main # Trigger the workflow on push events to the main branch + paths: + - 'devconsole/**' + # Trigger on a cron schedule (every weekday at 10:00 AM IST) + schedule: + - cron: '30 4 * * 1-5' # Adjusted for 10:00 AM IST in UTC workflow_dispatch: # Allow manual triggering of the workflow jobs: diff --git a/.github/workflows/konflux.yml b/.github/workflows/konflux.yml new file mode 100644 index 0000000..12f0ad0 --- /dev/null +++ b/.github/workflows/konflux.yml @@ -0,0 +1,21 @@ +name: Konflux Daily JIRA Status + +on: + push: + paths: + - 'konflu/**' + # Trigger on a cron schedule (every weekday at 10:00 AM IST) + schedule: + - cron: '30 4 * * 1-5' # Adjusted for 10:00 AM IST in UTC + workflow_dispatch: # Allow manual triggering of the workflow + +jobs: + run-script: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Run Bash Script + run: bash konflu/forum-konflu-ui.sh ${{ secrets.JIRA_PAT }} ${{ secrets.PERSONAL_SLACK_HOOK }} \ No newline at end of file diff --git a/.github/workflows/rhtap.yml b/.github/workflows/rhtap.yml deleted file mode 100644 index 5cd109f..0000000 --- a/.github/workflows/rhtap.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: RHTAP Daily JIRA Status - -on: - push: - branches: - - main # Trigger the workflow on push events to the main branch - workflow_dispatch: # Allow manual triggering of the workflow - -jobs: - run-script: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Run Bash Script - run: bash RHTAP/forum-rhtap-ui.sh ${{ secrets.JIRA_PAT }} ${{ secrets.PERSONAL_SLACK_HOOK }} \ No newline at end of file diff --git a/backstage/team-backstage.sh b/backstage/team-backstage.sh new file mode 100644 index 0000000..b26d2f8 --- /dev/null +++ b/backstage/team-backstage.sh @@ -0,0 +1,146 @@ +set -e + +echo "Generating Status Report" + +head="\nBackstage GitHub Status" + +PREVIOUS_DT=`date -v -7d "+%F"` + +echo "Fetching Github data" + +url1="https://api.github.com/search/issues?q=repo%3Ajanus-idp%2Fbackstage-showcase+state%3Aopen+type%3Apr+created%3A<$PREVIOUS_DT&type=Issues" +url2="https://api.github.com/search/issues?q=repo%3Ajanus-idp%2Fbackstage-plugins+state%3Aopen+type%3Apr+created%3A<$PREVIOUS_DT&type=Issues" +url3="https://api.github.com/search/issues?q=repo%3Ajanus-idp%2Fjanus-idp.github.io+state%3Aopen+type%3Apr+created%3A<$PREVIOUS_DT&type=Issues" + +showcase_github_data="\n: $(curl -s 'https://api.github.com/search/issues?q=repo%3Ajanus-idp%2Fbackstage-showcase+state%3Aopen+type%3Apr' -H "Accept: application/json" | jq '.total_count // 0')" +showcase_github_data+="\n: $(curl -s $url1 -H "Accept: application/json" | jq '.total_count // 0')" + +plugins_github_data="\n: $(curl -s 'https://api.github.com/search/issues?q=repo%3Ajanus-idp%2Fbackstage-plugins+state%3Aopen+type%3Apr' -H "Accept: application/json" | jq '.total_count // 0')" +plugins_github_data+="\n: $(curl -s $url2 -H "Accept: application/json" | jq '.total_count // 0')" + +janusidp_github_data="\n: $(curl -s 'https://api.github.com/search/issues?q=repo%3Ajanus-idp%2Fjanus-idp.github.io+state%3Aopen+type%3Apr' -H "Accept: application/json" | jq '.total_count // 0')" +janusidp_github_data+="\n: $(curl -s $url3 -H "Accept: application/json" | jq '.total_count // 0')" + +echo "Posting on slack" + +data='{ + text: 'GitHub Status report', + blocks: [ + { + "type": 'header', + text: { + "type": 'plain_text', + text: head + } + }, + { + "type": 'section', + fields: [ + { + "type": 'mrkdwn', + text: '*backstage-showcase*' + } + ] + }, + { + "type": 'section', + fields: [ + { + "type": 'mrkdwn', + text: github_data_a + }, + ] + }, + { + "type": 'divider' + }, + { + "type": 'section', + fields: [ + { + "type": 'mrkdwn', + text: '*backstage-plugins*' + } + ] + }, + { + "type": 'section', + fields: [ + { + "type": 'mrkdwn', + text: github_data_b + }, + ] + }, + { + "type": 'divider' + }, + { + "type": 'section', + fields: [ + { + "type": 'mrkdwn', + text: '*janus-idp.github.io*' + } + ] + }, + { + "type": 'section', + fields: [ + { + "type": 'mrkdwn', + text: github_data_c + }, + ] + }, + { + "type": 'divider' + }, + { + "type": 'section', + fields: [ + { + "type": 'mrkdwn', + text: '*operator*' + } + ] + }, + { + "type": 'section', + fields: [ + { + "type": 'mrkdwn', + text: github_data_d + }, + ] + }, + { + "type": 'divider' + }, + { + "type": "section", + fields: [ + { + "type": "mrkdwn", + text: "*red-hat-developers-documentation-rhdh*", + }, + ], + }, + { + "type": "section", + fields: [ + { + "type": "mrkdwn", + text: github_data_e, + }, + ], + }, + { + "type": "divider", + }, + ] +}' + +curl -X POST -H "Content-type:application/json" --data "$data" $1 + +echo "\nDone" \ No newline at end of file diff --git a/konflu/forum-koflu-ui.sh b/konflu/forum-koflu-ui.sh new file mode 100644 index 0000000..28e5fb9 --- /dev/null +++ b/konflu/forum-koflu-ui.sh @@ -0,0 +1,183 @@ +set -e + +authorization="Authorization: Bearer "$1 + +echo "Generating Status Report" + +# head="HELLO @hac-dev-team" +head='RHTAP UI' + +echo "Fetching RHTAP stories" + +hac_stories='\n\n*UI Stories* :toy-story-buzz::toy-story-buzz:' +hac_stories+="\n1. ($(curl -s "https://issues.redhat.com/rest/api/2/search?jql=filter=12396633" -H "Accept: application/json" | jq ".total"))" +alert_check=$(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12396635' -H "Accept: application/json" | jq '.total') +hac_stories+="\n2. ($alert_check)" +if [ $alert_check -ge 15 ]; then + hac_stories+=" :fire::fire:" +fi +hac_stories+="\n3. ($(curl -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12396638' -H "Accept: application/json" | jq '.total'))" +hac_stories+="\n4. ($(curl -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12396637' -H "Accept: application/json" | jq '.total'))" + +echo "Fetching RHTAP bugs" + +hac_bugs="\n\n *Bugs:* :bug::bug:" +hac_bugs+="\n1. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12396775' -H "Accept: application/json" | jq '.total'))" +alert_check=$(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12416904' -H "Accept: application/json" | jq '.total') +hac_bugs+="\n2. ($alert_check)" +if [ $alert_check -ge 45 ]; then + hac_bugs+=" :fire::fire:" +fi +alert_check=$(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12416902' -H "Accept: application/json" | jq '.total') +hac_bugs+="\n3. ($alert_check)" +if [ $alert_check -ge 25 ]; then + hac_bugs+=" :fire::fire:" +fi +alert_check=$(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12416903' -H "Accept: application/json" | jq '.total') +hac_bugs+="\n4. ($alert_check)" +if [ $alert_check -ge 25 ]; then + hac_bugs+=" :fire::fire:" +fi +hac_bugs+="\n5. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12396778' -H "Accept: application/json" | jq '.total'))" +hac_bugs+="\n6. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426879' -H "Accept: application/json" | jq '.total'))" + +# this is block 3 +echo "Fetching RHTAP dashboard" + +stonesoup_dashboard="\n\n *RHTAP Dashboard:* :clipboard::clipboard:" +stonesoup_dashboard+="\n1. ($(curl -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12405355' -H "Accept: application/json" | jq '.total'))" +alert_check=$(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12405357' -H "Accept: application/json" | jq '.total') +stonesoup_dashboard+="\n2. ($(curl -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12405357' -H "Accept: application/json" | jq '.total'))" +if [ $alert_check -ge 45 ]; then + stonesoup_dashboard+=" :fire::fire:" +fi +stonesoup_dashboard+="\n3. ($(curl -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12405358' -H "Accept: application/json" | jq '.total'))" +alert_check=$(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12405686' -H "Accept: application/json" | jq '.total') +stonesoup_dashboard+="\n4. ($alert_check)" +if [ $alert_check -ge 45 ]; then + stonesoup_dashboard+=" :fire::fire:" +fi + +echo "Fetching RHTAP bugs SLI data" + +rhtap_blockers="\n\n *RHTAP Blocker bugs:*" +rhtap_blockers+="\n1. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426878' -H "Accept: application/json" | jq '.total'))" +rhtap_blockers+="\n2. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426877' -H "Accept: application/json" | jq '.total'))" +rhtap_blockers+="\n3. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426876' -H "Accept: application/json" | jq '.total'))" + +rhtap_critical="\n\n *RHTAP Critical bugs:*" +rhtap_critical+="\n1. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426873' -H "Accept: application/json" | jq '.total'))" +rhtap_critical+="\n2. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426874' -H "Accept: application/json" | jq '.total'))" +rhtap_critical+="\n3. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426875' -H "Accept: application/json" | jq '.total'))" + +rhtap_major="\n\n" +rhtap_major+="\n\n *RHTAP Major bugs:*" +rhtap_major+="\n1. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426870' -H "Accept: application/json" | jq '.total'))" +rhtap_major+="\n2. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426871' -H "Accept: application/json" | jq '.total'))" +rhtap_major+="\n3. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426872' -H "Accept: application/json" | jq '.total'))" + +echo "Fetching Github data" + +github_data="\n\n *GitHub filters:* :github: :github:" +github_data+="\n: $(curl -s 'https://api.github.com/search/issues?q=repo%3Aopenshift%2Fhac-dev+state%3Aopen&type=issues' -H "Accept: application/json" | jq '.total_count')" +github_data+="\n: $(curl -s 'https://api.github.com/search/issues?q=repo%3Aopenshift%2Fhac-dev+state%3Aopen+-label%3algtm&type=issues' -H "Accept: application/json" | jq '.total_count')" +github_data+="\n: $(curl -s 'https://api.github.com/search/issues?q=repo%3Aopenshift%2Fhac-dev+state%3Aopen+-label%3aapproved&type=issues' -H "Accept: application/json" | jq '.total_count')" +github_data+="\n: $(curl -s 'https://api.github.com/search/issues?q=repo%3Aopenshift%2Fhac-dev+repo%3Aopenshift%2Fconsole+repo%3Aopenshift%2Fenhancements+repo%3Aopenshift%2Fconsole-operator+repo%3Aopenshift%2Fapi+-label%3Ado-not-merge%2Fwork-in-progress+-label%3Algtm+author%3Arohitkrai03+author%3Adebsmita1+author%3Ajeff-phillips-18+author%3AinvincibleJai+author%3Anemesis09+author%3Asahil143+author%3Avikram-raj+author%3Achristianvogt+author%3Ajerolimov+author%3AdivyanshiGupta+author%3Arottencandy+author%3Akarthikjeeyar+author%3Aabhinandan13jan+state%3Aopen+created%3A%3C2022-06-19+author%3ALucifergene+author%3Agruselhaus+author%3Alokanandaprabhu&type=repositories' -H "Accept: application/json" | jq '.total_count')" + +echo "Posting on slack" + + + +data='{ + "text": "Status report", + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": "'$head'" + } + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Current sprint status*" + } + ] + }, + { + "type":"divider", + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "'$hac_stories'" + }, + { + "type": "mrkdwn", + "text": "'$hac_bugs'" + } + ] + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*RHTAP Bugs SLI*" + } + ] + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "'$rhtap_blockers'" + }, + { + "type": "mrkdwn", + "text": "'$rhtap_critical'" + }, + { + "type": "mrkdwn", + "text": "'$rhtap_major'" + } + ] + }, + { + "type":"divider", + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "'$stonesoup_dashboard'" + } + ] + }, + { + "type":"divider", + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "'$github_data'" + } + }, + { + "type":"divider", + }, + ] +}' + +curl -X POST -H "Content-type:application/json" --data "$data" $2 + + +echo "\nDone" \ No newline at end of file diff --git a/konflu/forum-konflu-ui.js b/konflu/forum-konflu-ui.js new file mode 100644 index 0000000..8b435ab --- /dev/null +++ b/konflu/forum-konflu-ui.js @@ -0,0 +1,314 @@ +const SLACK_URL = '' +const JIRA_AUTH = '' + +export const fetchCount = (apiUrl, github = false) => { + + const jiraAuth = JIRA_AUTH + + return fetch(apiUrl, { + headers: { + ...(!github ? { 'Authorization': jiraAuth } : {}), + 'Accept': 'application/json' + } + }) + .then(response => response.json()) + .then(data => { + const totalCount = github ? data.total_count : data.total; + return totalCount; + }) + .catch(error => { + console.error('Error retrieving data:', error); + return error; + }); +} + +export const handler = async(event) => { + + console.log('Generating Status Report'); + + const head = '\nRHTAP UI'; + + console.log('Fetching RHTAP stories'); + + let hac_stories = '\n\n*UI Stories* :toy-story-buzz::toy-story-buzz:' + + let count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12396633'); + + hac_stories = hac_stories + `\n1. (${count})` + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12396635') + + hac_stories = hac_stories + `\n2. (${count})` + + if (count >= 15) { + hac_stories = hac_stories + " :fire::fire:" + } + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12396638') + + hac_stories = hac_stories + `\n3. (${count})` + + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12396637') + + hac_stories = hac_stories + `\n4. (${count})` + + console.log('Fetching RHTAP bugs'); + + let hac_bugs = "\n\n *Bugs:* :bug::bug:" + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12396775') + + hac_bugs = hac_bugs + `\n1. (${count})` + + + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12416904') + + hac_bugs = hac_bugs + `\n2. (${count})` + + if (count >= 45) { + hac_bugs = hac_bugs + " :fire::fire:" + } + + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12416902') + + hac_bugs = hac_bugs + `\n3. (${count})` + + if (count >= 25) { + hac_bugs = hac_bugs + " :fire::fire:" + } + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12416903') + + hac_bugs = hac_bugs + `\n4. (${count})` + + if (count >= 25) { + hac_bugs = hac_bugs + " :fire::fire:" + } + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12396778') + + hac_bugs = hac_bugs + `\n5. (${count})` + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12426879') + + hac_bugs = hac_bugs + `\n6. (${count})` + + console.log("Fetching RHTAP bugs SLI data"); + + let rhtap_blockers = "\n\n *RHTAP Blocker bugs:*"; + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12426878') + + rhtap_blockers = rhtap_blockers + `\n1. (${count})` + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12426877') + + rhtap_blockers = rhtap_blockers + `\n2. (${count})` + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12426876') + + rhtap_blockers = rhtap_blockers + `\n3. (${count})` + + let rhtap_critical="\n\n *RHTAP Critical bugs:*"; + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12426873') + + rhtap_critical = rhtap_critical + `\n1. (${count})` + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12426874') + + rhtap_critical = rhtap_critical + `\n2. (${count})` + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12426875') + + rhtap_critical = rhtap_critical + `\n3. (${count})` + + let rhtap_major="\n\n *RHTAP Major bugs:*"; + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12426870') + + rhtap_major = rhtap_major + `\n1. (${count})` + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12426871') + + rhtap_major = rhtap_major + `\n2. (${count})` + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12426872') + + rhtap_major = rhtap_major + `\n3. (${count})` + + + + console.log('Fetching RHTAP dashboard'); + + + let stonesoup_dashboard = "\n\n *RHTAP Dashboard:* :clipboard::clipboard:" + + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12405355') + + stonesoup_dashboard = stonesoup_dashboard + `\n1. (${count})` + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12405357') + + stonesoup_dashboard = stonesoup_dashboard + `\n2. (${count})` + + if (count >= 45) { + stonesoup_dashboard = stonesoup_dashboard + " :fire::fire:" + } + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12405358') + + stonesoup_dashboard = stonesoup_dashboard + `\n3. (${count})` + + + count = await fetchCount('https://issues.redhat.com/rest/api/2/search?jql=filter=12405686') + + stonesoup_dashboard = stonesoup_dashboard + `\n4. (${count})` + + if (count >= 45) { + stonesoup_dashboard = stonesoup_dashboard + " :fire::fire:" + } + + console.log("Fetching Github data") + + + let github_data = "\n\n *GitHub filters:* :github: :github:" + + count = await fetchCount('https://api.github.com/search/issues?q=repo%3Aopenshift%2Fhac-dev+state%3Aopen&type=issues', true) + + github_data = github_data + `\n: (${count})` + + count = await fetchCount('https://api.github.com/search/issues?q=repo%3Aopenshift%2Fhac-dev+state%3Aopen+-label%3algtm&type=issues', true) + + github_data = github_data + `\n: (${count})` + + count = await fetchCount('https://api.github.com/search/issues?q=repo%3Aopenshift%2Fhac-dev+state%3Aopen+-label%3aapproved&type=issues', true) + + github_data = github_data + `\n: (${count})` + + count = await fetchCount('https://api.github.com/search/issues?q=repo%3Aopenshift%2Fhac-dev+repo%3Aopenshift%2Fconsole+repo%3Aopenshift%2Fenhancements+repo%3Aopenshift%2Fconsole-operator+repo%3Aopenshift%2Fapi+-label%3Ado-not-merge%2Fwork-in-progress+-label%3Algtm+author%3Arohitkrai03+author%3Adebsmita1+author%3Ajeff-phillips-18+author%3AinvincibleJai+author%3Anemesis09+author%3Asahil143+author%3Avikram-raj+author%3Achristianvogt+author%3Ajerolimov+author%3AdivyanshiGupta+author%3Arottencandy+author%3Akarthikjeeyar+author%3Aabhinandan13jan+state%3Aopen+created%3A%3C2022-06-19+author%3ALucifergene+author%3Agruselhaus+author%3Alokanandaprabhu&type=repositories', true) + + github_data = github_data + `\n: (${count})` + + console.log('Posting on #forum-rhtap slack channel'); + + const data = JSON.stringify({ + text: 'Status report', + blocks: [ + { + type: 'header', + text: { + type: 'plain_text', + text: head + } + }, + { + type: 'section', + fields: [ + { + type: 'mrkdwn', + text: '*Current sprint status*' + } + ] + }, + { + type: 'divider' + }, + { + type: 'section', + fields: [ + { + type: 'mrkdwn', + text: hac_stories + }, + { + type: 'mrkdwn', + text: hac_bugs + } + ] + }, + { + type: 'section', + fields: [ + { + type: 'mrkdwn', + text: '*RHTAP Bugs SLI*' + } + ] + }, + { + type: 'section', + fields: [ + { + type: 'mrkdwn', + text: rhtap_blockers + }, + { + type: 'mrkdwn', + text: rhtap_critical + }, + { + type: 'mrkdwn', + text: rhtap_major + } + ] + }, + { + type: 'divider' + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": stonesoup_dashboard + } + ] + }, + { + type: 'divider' + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": github_data + } + }, + { + "type": "divider", + }, + ] + }); + + let response; + try { + response = await fetch(SLACK_URL, { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: data + }); + } catch (error) { + console.error('Error sending requests:', error); + } + + if (response?.ok) { + console.log('Request sent successfully'); + return { + statusCode: 200, + body: 'Done' + }; + } else { + console.error('Error sending requests:', response?.statusText); + return { + statusCode: response?.status, + body: 'Error' + }; + } +}; diff --git a/konflux/forum-rhtap-ui.sh b/konflux/forum-rhtap-ui.sh new file mode 100644 index 0000000..28e5fb9 --- /dev/null +++ b/konflux/forum-rhtap-ui.sh @@ -0,0 +1,183 @@ +set -e + +authorization="Authorization: Bearer "$1 + +echo "Generating Status Report" + +# head="HELLO @hac-dev-team" +head='RHTAP UI' + +echo "Fetching RHTAP stories" + +hac_stories='\n\n*UI Stories* :toy-story-buzz::toy-story-buzz:' +hac_stories+="\n1. ($(curl -s "https://issues.redhat.com/rest/api/2/search?jql=filter=12396633" -H "Accept: application/json" | jq ".total"))" +alert_check=$(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12396635' -H "Accept: application/json" | jq '.total') +hac_stories+="\n2. ($alert_check)" +if [ $alert_check -ge 15 ]; then + hac_stories+=" :fire::fire:" +fi +hac_stories+="\n3. ($(curl -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12396638' -H "Accept: application/json" | jq '.total'))" +hac_stories+="\n4. ($(curl -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12396637' -H "Accept: application/json" | jq '.total'))" + +echo "Fetching RHTAP bugs" + +hac_bugs="\n\n *Bugs:* :bug::bug:" +hac_bugs+="\n1. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12396775' -H "Accept: application/json" | jq '.total'))" +alert_check=$(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12416904' -H "Accept: application/json" | jq '.total') +hac_bugs+="\n2. ($alert_check)" +if [ $alert_check -ge 45 ]; then + hac_bugs+=" :fire::fire:" +fi +alert_check=$(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12416902' -H "Accept: application/json" | jq '.total') +hac_bugs+="\n3. ($alert_check)" +if [ $alert_check -ge 25 ]; then + hac_bugs+=" :fire::fire:" +fi +alert_check=$(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12416903' -H "Accept: application/json" | jq '.total') +hac_bugs+="\n4. ($alert_check)" +if [ $alert_check -ge 25 ]; then + hac_bugs+=" :fire::fire:" +fi +hac_bugs+="\n5. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12396778' -H "Accept: application/json" | jq '.total'))" +hac_bugs+="\n6. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426879' -H "Accept: application/json" | jq '.total'))" + +# this is block 3 +echo "Fetching RHTAP dashboard" + +stonesoup_dashboard="\n\n *RHTAP Dashboard:* :clipboard::clipboard:" +stonesoup_dashboard+="\n1. ($(curl -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12405355' -H "Accept: application/json" | jq '.total'))" +alert_check=$(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12405357' -H "Accept: application/json" | jq '.total') +stonesoup_dashboard+="\n2. ($(curl -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12405357' -H "Accept: application/json" | jq '.total'))" +if [ $alert_check -ge 45 ]; then + stonesoup_dashboard+=" :fire::fire:" +fi +stonesoup_dashboard+="\n3. ($(curl -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12405358' -H "Accept: application/json" | jq '.total'))" +alert_check=$(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12405686' -H "Accept: application/json" | jq '.total') +stonesoup_dashboard+="\n4. ($alert_check)" +if [ $alert_check -ge 45 ]; then + stonesoup_dashboard+=" :fire::fire:" +fi + +echo "Fetching RHTAP bugs SLI data" + +rhtap_blockers="\n\n *RHTAP Blocker bugs:*" +rhtap_blockers+="\n1. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426878' -H "Accept: application/json" | jq '.total'))" +rhtap_blockers+="\n2. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426877' -H "Accept: application/json" | jq '.total'))" +rhtap_blockers+="\n3. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426876' -H "Accept: application/json" | jq '.total'))" + +rhtap_critical="\n\n *RHTAP Critical bugs:*" +rhtap_critical+="\n1. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426873' -H "Accept: application/json" | jq '.total'))" +rhtap_critical+="\n2. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426874' -H "Accept: application/json" | jq '.total'))" +rhtap_critical+="\n3. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426875' -H "Accept: application/json" | jq '.total'))" + +rhtap_major="\n\n" +rhtap_major+="\n\n *RHTAP Major bugs:*" +rhtap_major+="\n1. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426870' -H "Accept: application/json" | jq '.total'))" +rhtap_major+="\n2. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426871' -H "Accept: application/json" | jq '.total'))" +rhtap_major+="\n3. ($(curl -H "$authorization" -s 'https://issues.redhat.com/rest/api/2/search?jql=filter=12426872' -H "Accept: application/json" | jq '.total'))" + +echo "Fetching Github data" + +github_data="\n\n *GitHub filters:* :github: :github:" +github_data+="\n: $(curl -s 'https://api.github.com/search/issues?q=repo%3Aopenshift%2Fhac-dev+state%3Aopen&type=issues' -H "Accept: application/json" | jq '.total_count')" +github_data+="\n: $(curl -s 'https://api.github.com/search/issues?q=repo%3Aopenshift%2Fhac-dev+state%3Aopen+-label%3algtm&type=issues' -H "Accept: application/json" | jq '.total_count')" +github_data+="\n: $(curl -s 'https://api.github.com/search/issues?q=repo%3Aopenshift%2Fhac-dev+state%3Aopen+-label%3aapproved&type=issues' -H "Accept: application/json" | jq '.total_count')" +github_data+="\n: $(curl -s 'https://api.github.com/search/issues?q=repo%3Aopenshift%2Fhac-dev+repo%3Aopenshift%2Fconsole+repo%3Aopenshift%2Fenhancements+repo%3Aopenshift%2Fconsole-operator+repo%3Aopenshift%2Fapi+-label%3Ado-not-merge%2Fwork-in-progress+-label%3Algtm+author%3Arohitkrai03+author%3Adebsmita1+author%3Ajeff-phillips-18+author%3AinvincibleJai+author%3Anemesis09+author%3Asahil143+author%3Avikram-raj+author%3Achristianvogt+author%3Ajerolimov+author%3AdivyanshiGupta+author%3Arottencandy+author%3Akarthikjeeyar+author%3Aabhinandan13jan+state%3Aopen+created%3A%3C2022-06-19+author%3ALucifergene+author%3Agruselhaus+author%3Alokanandaprabhu&type=repositories' -H "Accept: application/json" | jq '.total_count')" + +echo "Posting on slack" + + + +data='{ + "text": "Status report", + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": "'$head'" + } + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Current sprint status*" + } + ] + }, + { + "type":"divider", + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "'$hac_stories'" + }, + { + "type": "mrkdwn", + "text": "'$hac_bugs'" + } + ] + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*RHTAP Bugs SLI*" + } + ] + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "'$rhtap_blockers'" + }, + { + "type": "mrkdwn", + "text": "'$rhtap_critical'" + }, + { + "type": "mrkdwn", + "text": "'$rhtap_major'" + } + ] + }, + { + "type":"divider", + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "'$stonesoup_dashboard'" + } + ] + }, + { + "type":"divider", + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "'$github_data'" + } + }, + { + "type":"divider", + }, + ] +}' + +curl -X POST -H "Content-type:application/json" --data "$data" $2 + + +echo "\nDone" \ No newline at end of file