Skip to content

Commit da88fdf

Browse files
authored
backport of commit 8d07c29
1 parent 6c0bb0a commit da88fdf

File tree

702 files changed

+682
-4492
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

702 files changed

+682
-4492
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33

44
blank_issues_enabled: false
55
contact_links:
6-
- name: Create a documentation issue
7-
url: https://github.com/hashicorp/web-unified-docs/issues
8-
about: Create a Nomad documentation bug or content request in the web-unified-docs repository.
96
- name: Ask a Question
107
url: https://discuss.hashicorp.com/c/nomad
118
about: If you have a question, or are looking for advice, please post on our Discuss forum.
12-
- name: Nomad Tutorials
13-
url: https://developer.hashicorp.com/nomad/tutorials
14-
about: Please check out our tutorials. These tutorials provide in-depth learning on Nomad features.
9+
- name: Nomad Learn Tracks
10+
url: https://learn.hashicorp.com/nomad
11+
about: Please check out our Learn Guides. These hands on guides deal with many of the tasks common to using Nomad.

.github/actions/jira/shared.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ TEXT_CLEAR='\e[0m'
77

88
# Make a request to the Jira API
99
function jira-request() {
10-
curl --show-error --location --fail-with-body \
10+
curl --show-error --location --fail \
1111
--user "${JIRA_USER_EMAIL}:${JIRA_API_TOKEN}" \
1212
--header "Accept: application/json" \
1313
--header "Content-Type: application/json" \

.github/actions/jira/transition/action.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,9 @@ inputs:
77
issue:
88
required: true
99
description: JIRA issue to transition
10-
resolution:
11-
required: false
12-
description: Resolution name to apply to issue
1310
transition:
1411
required: true
1512
description: Transition name to apply to issue
16-
fixed-version:
17-
required: false
18-
description: Version fixed (only used if resolution set. Use 'auto' for detection in nomad.)
19-
timeline-url:
20-
required: false
21-
description: GitHub API issue timeline URL (required if fixed-version is set to 'auto')
22-
project:
23-
required: false
24-
description: JIRA project (required for setting fixed-version)
25-
default: NMD
2613

2714
runs:
2815
using: composite
@@ -33,7 +20,3 @@ runs:
3320
env:
3421
ISSUE: ${{ inputs.issue }}
3522
TRANSITION: ${{ inputs.transition }}
36-
RESOLUTION: ${{ inputs.resolution }}
37-
FIXED_VERSION: ${{ inputs.fixed-version }}
38-
TIMELINE_URL: ${{ inputs.timeline-url }}
39-
PROJECT: ${{ inputs.project }}

.github/actions/jira/transition/jira-transition.bash

Lines changed: 11 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
source "$(dirname "${BASH_SOURCE[0]}")/../shared.bash"
66

7-
# Do all the checks up front so we just bail before
8-
# doing any actual work.
9-
7+
# Check for required inputs
108
if [ -z "${ISSUE}" ]; then
119
error "Missing 'issue' input value"
1210
exit 1
@@ -17,21 +15,6 @@ if [ -z "${TRANSITION}" ]; then
1715
exit 1
1816
fi
1917

20-
if [ -n "${FIXED_VERSION}" ] && [ -z "${RESOLUTION}" ]; then
21-
error "The 'fixed-version' value can only be set if 'resolution' is set"
22-
exit 1
23-
fi
24-
25-
if [ -n "${FIXED_VERSION}" ] && [ -z "${PROJECT}" ]; then
26-
error "Missing 'project' input value (must be set if 'fixed-version' is set)"
27-
exit 1
28-
fi
29-
30-
if [ "${FIXED_VERSION}" == "auto" ] && [ -z "${TIMELINE_URL}" ]; then
31-
error "Missing 'timeline-url' input value (must be set if 'fixed-version' is 'auto')"
32-
exit 1
33-
fi
34-
3518
# Grab the transition ID
3619
result="$(jira-request "${JIRA_BASE_URL}/rest/api/3/issue/${ISSUE}/transitions")" || exit
3720
query="$(printf '.transitions[] | select(.name == "%s").id' "${TRANSITION}")"
@@ -42,100 +25,20 @@ if [ -z "${transition_id}" ]; then
4225
exit 1
4326
fi
4427

45-
# Create the initial payload. This will be updated as needed prior
46-
# to sending the request.
47-
template='{transition: {id: $transition_id}}'
48-
payload="$(jq -n --arg transition_id "${transition_id}" "${template}")" || exit
28+
template='
29+
{
30+
transition: {
31+
id: $transition
32+
}
33+
}
34+
'
35+
issue_transition="$(jq -n --arg transition "${transition_id}" "${template}")" || exit
4936

5037
info "Transitioning JIRA issue '%s' to %s (ID: %s)" "${ISSUE}" \
5138
"${TRANSITION}" "${transition_id}"
39+
info "Transition payload:\n%s" "${issue_transition}"
5240

53-
# If a resolution is set, find it
54-
if [ -n "${RESOLUTION}" ]; then
55-
# Grab the resolution ID
56-
result="$(jira-request "${JIRA_BASE_URL}/rest/api/3/resolution")" || exit
57-
query="$(printf '.[] | select(.name == "%s").id' "${RESOLUTION}")"
58-
resolution_id="$(jq -r "${query}" <<< "${result}")"
59-
60-
if [ -z "${resolution_id}" ]; then
61-
error "Could not find matching resolution with name matching '%s'" "${RESOLUTION}"
62-
exit 1
63-
fi
64-
65-
# Render the data structure for the resolution
66-
template='{fields: {resolution: {id: $resolution_id}}}'
67-
rendered="$(jq -n --arg resolution_id "${resolution_id}" "${template}")" || exit
68-
69-
# Add it to the payload
70-
payload="$(jq -s '.[0] * .[1]' <<< "${payload}${rendered}")"
71-
72-
info "Resolving JIRA issue '%s' to %s (ID: %s)" "${ISSUE}" "${RESOLUTION}" "${resolution_id}"
73-
fi
74-
75-
# Handle setting fixed versions if set
76-
if [ -n "${FIXED_VERSION}" ]; then
77-
fixed_versions=()
78-
79-
# First pull the valid versions from jira
80-
project="$(jira-request "${JIRA_BASE_URL}/rest/api/3/project/${PROJECT}")" || exit
81-
jira_versions="$(jq -r '.versions' <<< "${project}")"
82-
83-
# If the fixed version value is auto, attempt to detect versions from pull linked pull request
84-
if [ "${FIXED_VERSION}" == "auto" ]; then
85-
timeline="$(curl -sL --show-error --fail-with-body -H "Accept: application/vnd.github+json" "${TIMELINE_URL}")" || exit
86-
filter='.[] | select(.event == "cross-referenced") | .source.issue.labels.[] | select(.name | startswith("backport")).name'
87-
readarray -t labels < <(jq -r "${filter}" <<< "${timeline}")
88-
89-
for label in "${labels[@]}"; do
90-
# start with stripping off the start of the label (backport/ or backport/ent/)
91-
version_prefix="${label##*/}"
92-
# then strip off the end of the label
93-
version_prefix="${version_prefix%.x*}"
94-
95-
filter="$(printf '.[] | select(.name | contains("%s")).name' "${version_prefix}")"
96-
readarray -t valid_versions < <(jq -r "${filter}" <<< "${jira_versions}")
97-
match="${version_prefix}.0"
98-
for v in "${valid_versions[@]}"; do
99-
if [ "${v##*.}" -gt "${match##*.}" ]; then
100-
match="${v}"
101-
fi
102-
done
103-
104-
filter="$(printf '.[] | select(.name | endswith("%s")).id' "${match}")"
105-
version_id="$(jq -r "${filter}" <<< "${jira_versions}")"
106-
if [ -z "${version_id}" ]; then
107-
printf "WARNING: Failed to find valid JIRA version to match label: '%s'\n" "${label}"
108-
continue
109-
fi
110-
fixed_versions+=("$(jq -n --arg version_id "${version_id}" '[{id: $version_id}]')")
111-
done
112-
else
113-
# Match version directly
114-
filter="$(printf '.[] | select(.name | endswith("%s")).id' "${FIXED_VERSION}")"
115-
version_id="$(jq -r "${filter}" <<< "${jira_versions}")"
116-
if [ -z "${version_id}" ]; then
117-
printf "WARNING: Failed to find valid JIRA version to match provided version: '%s'\n" "${FIXED_VERSION}"
118-
else
119-
fixed_versions+=(jq -n --arg version_id "${version_id}" '[{id: $version_id}]')
120-
fi
121-
fi
122-
123-
# If fixed versions are availble, create the data structure
124-
if [ "${#fixed_versions[@]}" -gt "0" ]; then
125-
template='{fields: {fixVersions: $versions}}'
126-
# Combine all the versions into a single array
127-
versions="$(jq -s 'add' <<< "${fixed_versions[*]}")"
128-
# Render the data structure for the fix versions
129-
rendered="$(jq -n --argjson versions "${versions}" "${template}")" || exit
130-
131-
# Add it to the payload
132-
payload="$(jq -s '.[0] * .[1]' <<< "${payload}${rendered}")"
133-
fi
134-
fi
135-
136-
info "Transition payload:\n%s" "${payload}"
137-
138-
jira-request --request "POST" --data "${payload}" \
41+
jira-request --request "POST" --data "${issue_transition}" \
13942
"${JIRA_BASE_URL}/rest/api/3/issue/${ISSUE}/transitions" || exit
14043

14144
info "JIRA issue '%s' transitioned to %s" "${ISSUE}" "${TRANSITION}"

.github/pull_request_template.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ merged.
2121
- [ ] **Testing** Please add tests to cover any new functionality or to demonstrate bug fixes and
2222
ensure regressions will be caught.
2323
- [ ] **Documentation** If the change impacts user-facing functionality such as the CLI, API, UI,
24-
and job configuration, please update the Nomad product documentation, which is stored in the
25-
[`web-unified-docs` repo](../web-unified-docs/). Refer to the [`web-unified-docs` contributor guide](../web-unified-docs/tree/docs/contribute.md) for docs guidelines.
26-
Please also consider whether the change requires notes within the [upgrade
27-
guide](https://developer.hashicorp.com/nomad/docs/upgrade/upgrade-specific). If you would like help with the docs, tag the `nomad-docs` team in this PR.
24+
and job configuration, please update the Nomad website documentation to reflect this. Refer to
25+
the [website README](../website/README.md) for docs guidelines. Please also consider whether the
26+
change requires notes within the [upgrade guide](../website/content/docs/upgrade/upgrade-specific.mdx).
2827

2928
### Reviewer Checklist
3029
- [ ] **Backport Labels** Please add the correct backport labels as described by the internal
@@ -33,7 +32,7 @@ merged.
3332
in the majority of situations. The main exceptions are long-lived feature branches or merges where
3433
history should be preserved.
3534
- [ ] **Enterprise PRs** If this is an enterprise only PR, please add any required changelog entry
36-
within the public repository.
35+
within the public repository.
3736

3837

3938
<!-- heimdall_github_prtemplate:grc-pci_dss-2024-01-05 -->
@@ -43,3 +42,4 @@ merged.
4342
## Changes to Security Controls
4443

4544
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
45+

.github/workflows/jira-sync.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ jobs:
5858
with:
5959
issue: ${{ steps.search.outputs.issue }}
6060
transition: "Closed"
61-
resolution: "Done"
62-
fixed-version: "auto"
63-
project: NMD
64-
timeline-url: ${{ github.event.issue.timeline_url }}
6561
- name: Reopen ticket
6662
if: github.event.action == 'reopened' && steps.search.outputs.issue
6763
uses: ./.github/actions/jira/transition

.github/workflows/release.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,8 @@ jobs:
124124
echo "::group::Fetch all git repo"
125125
git fetch --unshallow
126126
echo "::endgroup::"
127-
version="${{ github.event.inputs.version }}"
128-
header="${version//+ent/ Enterprise}"
129-
echo -e "## $header ($(date '+%B %d, %Y'))\n$(make changelog)\n\n$(cat CHANGELOG.md)" > CHANGELOG.md
127+
128+
echo -e "## ${{ github.event.inputs.version }} ($(date '+%B %d, %Y'))\n$(make changelog)\n\n$(cat CHANGELOG.md)" > CHANGELOG.md
130129
git diff --color=always CHANGELOG.md
131130
env:
132131
LAST_RELEASE: ${{ github.event.inputs.changelog-last-release }}

.release/versions.hcl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66

77
schema = 1
88
active_versions {
9-
version "1.11.x" {
10-
ce_active = true
11-
lts = true
12-
}
139
version "1.10.x" {
1410
ce_active = true
1511
lts = true
1612
}
13+
version "1.9.x" {
14+
ce_active = true # needed for docs
15+
}
1716
version "1.8.x" {
1817
ce_active = true # needed for docs
1918
lts = true

0 commit comments

Comments
 (0)