This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
Nomad: waypoint-static-runner - error connecting to server context deadline exceeded #1700
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
issues: | |
# `labeled` is for copying GH Issue -> Jira; other states are for updating the created Jira issue when the GH Issue has a change | |
types: [labeled, closed, deleted, reopened] | |
# On Waypoint, we don't put PRs into Jira at this time | |
pull_request_target: | |
types: [labeled, opened, closed, reopened] | |
issue_comment: | |
# Allows the copying of GitHub Issue comments to the corresponding Jira ticket (1-way only, GH->Jira) | |
types: [created] | |
name: Jira Sync | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
name: Jira sync | |
if: contains(github.event.label.name, 'jira') | |
steps: | |
- name: Login | |
uses: atlassian/gajira-login@ca13f8850ea309cf44a6e4e0c49d9aa48ac3ca4c # v3 | |
env: | |
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} | |
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} | |
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} | |
- name: Set ticket type | |
id: set-ticket-type | |
run: echo "type=GH Issue" >> "$GITHUB_OUTPUT" | |
# Use this to add Jira labels to a ticket based on what labels are present in GitHub | |
# bash note: '${#VAR}' returns the length of the variable's value | |
# label assignment is simple; currently assigns 'ui', 'documentation', or 'backend' | |
# with 'backend' being a catchall for things not 'ui' | |
- name: Set ticket labels | |
if: github.event.action == 'labeled' # the parent if-statement checks for a label with a value of "Jira", so here we just need to know if that label is new or not | |
id: set-ticket-labels | |
run: | | |
LABELS="[" | |
if [[ "${{ contains(github.event.issue.labels.*.name, 'documentation') }}" == "true" ]]; then LABELS+="\"engineering\", "; fi | |
if [[ "${{ contains(github.event.issue.labels.*.name, 'ui') }}" == "true" ]]; then LABELS+="\"experiences\", "; else LABELS+="\"foundations\", "; fi | |
if [[ ${#LABELS} != 1 ]]; then LABELS=${LABELS::-2}"]"; else LABELS+="]"; fi | |
echo "labels=${LABELS}" >> "$GITHUB_OUTPUT" | |
# Only Waypoint team members may add GitHub issues to Jira | |
- name: Check if team member | |
if: github.event.action == 'labeled' | |
id: is-team-member | |
run: | | |
TEAM=waypoint | |
ROLE="$(hub api orgs/hashicorp/teams/${TEAM}/memberships/${{ github.actor }} | jq -r '.role | select(.!=null)')" | |
if [[ -n ${ROLE} ]]; then | |
echo "Actor ${{ github.actor }} is a ${TEAM} team member" | |
echo "message=true" >> "$GITHUB_OUTPUT" | |
else | |
echo "Actor ${{ github.actor }} is NOT a ${TEAM} team member" | |
echo "message=false" >> "$GITHUB_OUTPUT" | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.JIRA_SYNC_GITHUB_TOKEN }} | |
- name: Search | |
id: search | |
uses: tomhjp/gh-action-jira-search@04700b457f317c3e341ce90da5a3ff4ce058f2fa # v0.2.2 | |
with: | |
# cf[10089] is Issue Link (use JIRA API to retrieve) | |
jql: 'cf[10089] = "${{ github.event.issue.html_url || github.event.pull_request.html_url }}"' | |
- name: Create ticket | |
if: ( github.event.action == 'labeled' && steps.is-team-member.outputs.message == 'true' && !steps.search.outputs.issue ) | |
uses: tomhjp/gh-action-jira-create@3ed1789cad3521292e591a7cfa703215ec1348bf # v0.2.1 | |
with: | |
project: WAYP | |
issuetype: "${{ steps.set-ticket-type.outputs.type }}" | |
summary: "${{ github.event.repository.name }} [#${{ github.event.issue.number || github.event.pull_request.number }}]: ${{ github.event.issue.title || github.event.pull_request.title }}" | |
description: "${{ github.event.issue.body || github.event.pull_request.body }}\n\n_Created in GitHub by ${{ github.actor }}._" | |
# customfield_10089 is "Issue Link", customfield_10371 is "Source" (use JIRA API to retrieve) | |
extraFields: '{ "customfield_10089": "${{ github.event.issue.html_url || github.event.pull_request.html_url }}", "labels": ${{ steps.set-ticket-labels.outputs.labels }} }' | |
- name: Sync comment | |
if: github.event.action == 'created' && steps.search.outputs.issue | |
uses: tomhjp/gh-action-jira-comment@6eb6b9ead70221916b6badd118c24535ed220bd9 # v0.2.0 | |
with: | |
issue: ${{ steps.search.outputs.issue }} | |
comment: "${{ github.actor }} ${{ github.event.review.state || 'commented' }}:\n\n${{ github.event.comment.body || github.event.review.body }}\n\n${{ github.event.comment.html_url || github.event.review.html_url }}" | |
- name: Close ticket | |
if: ( github.event.action == 'closed' || github.event.action == 'deleted' ) && steps.search.outputs.issue | |
uses: atlassian/gajira-transition@4749176faf14633954d72af7a44d7f2af01cc92b # v3 | |
with: | |
issue: ${{ steps.search.outputs.issue }} | |
transition: "Closed" | |
- name: Reopen ticket | |
if: github.event.action == 'reopened' && steps.search.outputs.issue | |
uses: atlassian/gajira-transition@4749176faf14633954d72af7a44d7f2af01cc92b # v3 | |
with: | |
issue: ${{ steps.search.outputs.issue }} | |
transition: "Pending Triage" | |
permissions: | |
contents: read |