Skip to content

Commit

Permalink
Issue #12451: Restore curl --fail-with-body
Browse files Browse the repository at this point in the history
  • Loading branch information
stoyanK7 authored and romani committed Mar 18, 2023
1 parent 75dfa0c commit 08c41a9
Show file tree
Hide file tree
Showing 23 changed files with 33 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .ci/no-old-refs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ for MENTIONED_ISSUES_GREP_OUTPUT_LINE in $(cat $MENTIONED_ISSUES_GREP_OUTPUT); d

LINK="$GITHUB_HOST/$MAIN_REPO/blob/$DEFAULT_BRANCH/$FILE_PATH#L$LINE_NUMBER"

STATE=$(curl -s -H \
STATE=$(curl --fail-with-body -s -H \
"Authorization: token $GITHUB_TOKEN" "$API_GITHUB_PREFIX/$ISSUE" \
| jq '.state' | xargs)
if [ "$STATE" = "closed" ]; then
Expand Down
6 changes: 3 additions & 3 deletions .ci/pr-description.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

if [[ ! $PULL_REQUEST =~ ^([0-9]*)$ ]]; then exit 0; fi
LINK_COMMITS=https://api.github.com/repos/checkstyle/checkstyle/pulls/$PULL_REQUEST/commits
COMMITS=$(curl -s -H "Authorization: token $READ_ONLY_TOKEN" "$LINK_COMMITS" \
COMMITS=$(curl --fail-with-body -s -H "Authorization: token $READ_ONLY_TOKEN" "$LINK_COMMITS" \
| jq '.[0] | .commit.message')
echo 'Commit messages from github: '"${COMMITS:0:60}"...
ISSUE_NUMBER=$(echo "$COMMITS" | sed -e 's/^.*Issue //' | sed -e 's/:.*//')
Expand All @@ -13,15 +13,15 @@ if [[ $ISSUE_NUMBER =~ ^#[0-9]+$ ]]; then
LINK_PR=https://api.github.com/repos/checkstyle/checkstyle/pulls/$PULL_REQUEST
LINK_ISSUE=https://api.github.com/repos/checkstyle/checkstyle/issues/${ISSUE_NUMBER:1}
REGEXP=($ISSUE_NUMBER\|https://github.com/checkstyle/checkstyle/issues/${ISSUE_NUMBER:1})
PR_DESC=$(curl -s -H "Authorization: token $READ_ONLY_TOKEN" "$LINK_PR" \
PR_DESC=$(curl --fail-with-body -s -H "Authorization: token $READ_ONLY_TOKEN" "$LINK_PR" \
| jq '.body' | grep -E "$REGEXP" | cat )
echo 'PR Description grepped:'"${PR_DESC:0:80}"
if [[ -z $PR_DESC ]]; then
echo 'Please put a reference to an Issue in the PR description,'
echo 'this will bind the Issue to your PR in Github'
RESULT=1;
fi
LABEL_APRV=$(curl -s -H "Authorization: token $READ_ONLY_TOKEN" "$LINK_ISSUE" \
LABEL_APRV=$(curl --fail-with-body -s -H "Authorization: token $READ_ONLY_TOKEN" "$LINK_ISSUE" \
| jq '.labels [] | .name' | grep approved | cat | wc -l )
if [[ $LABEL_APRV == 0 ]]; then
echo 'You are providing a PR for an Issue that is not approved yet,'
Expand Down
6 changes: 3 additions & 3 deletions .ci/release-close-create-milestone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ source ./.ci/util.sh
checkForVariable "GITHUB_TOKEN"

echo "Close previous milestone at github"
MILESTONE_NUMBER=$(curl -s \
MILESTONE_NUMBER=$(curl --fail-with-body -s \
-H "Authorization: token $GITHUB_TOKEN" \
-X GET https://api.github.com/repos/checkstyle/checkstyle/milestones?state=open \
| jq ".[0] | .number")
curl -i -H "Authorization: token $GITHUB_TOKEN" \
curl --fail-with-body -i -H "Authorization: token $GITHUB_TOKEN" \
-d "{ \"state\": \"closed\" }" \
-X PATCH https://api.github.com/repos/checkstyle/checkstyle/milestones/"$MILESTONE_NUMBER"

Expand All @@ -26,7 +26,7 @@ LAST_SUNDAY_DAY=$(cal -d "$(date -d "next month" +"%Y-%m")" \
LAST_SUNDAY_DATETIME=$(date -d "next month" +"%Y-%m")"-$LAST_SUNDAY_DAY""T08:00:00Z"
echo "$LAST_SUNDAY_DATETIME"

curl -i -H "Authorization: token $GITHUB_TOKEN" \
curl --fail-with-body -i -H "Authorization: token $GITHUB_TOKEN" \
-d "{ \"title\": \"$CURRENT_VERSION\", \
\"state\": \"open\", \
\"description\": \"\", \
Expand Down
4 changes: 2 additions & 2 deletions .ci/release-create-issues-in-other-repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ TARGET_VERSION=$1
echo TARGET_VERSION="$TARGET_VERSION"

echo "Creation of issue in eclipse-cs repo ..."
curl -i -H "Authorization: token $GITHUB_TOKEN" \
curl --fail-with-body -i -H "Authorization: token $GITHUB_TOKEN" \
-d "{ \"title\": \"upgrade to checkstyle $TARGET_VERSION\", \
\"body\": \"https://checkstyle.org/releasenotes.html#Release_$TARGET_VERSION\" \
}" \
-X POST https://api.github.com/repos/checkstyle/eclipse-cs/issues

echo "Creation of issue in sonar-checkstyle repo ..."
curl -i -H "Authorization: token $GITHUB_TOKEN" \
curl --fail-with-body -i -H "Authorization: token $GITHUB_TOKEN" \
-d "{ \"title\": \"upgrade to checkstyle $TARGET_VERSION\", \
\"body\": \"https://checkstyle.org/releasenotes.html#Release_$TARGET_VERSION\" \
}" \
Expand Down
2 changes: 1 addition & 1 deletion .ci/release-publish-releasenotes-twitter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fi

cd .ci-temp/checkstyle

curl https://api.github.com/repos/checkstyle/checkstyle/releases \
curl --fail-with-body https://api.github.com/repos/checkstyle/checkstyle/releases \
-H "Authorization: token $GITHUB_READ_ONLY_TOKEN" \
-o /var/tmp/cs-releases.json

Expand Down
4 changes: 2 additions & 2 deletions .ci/release-update-github-page.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fi

cd .ci-temp/checkstyle

curl https://api.github.com/repos/checkstyle/checkstyle/releases \
curl --fail-with-body https://api.github.com/repos/checkstyle/checkstyle/releases \
-H "Authorization: token $GITHUB_TOKEN" \
-o /var/tmp/cs-releases.json

Expand Down Expand Up @@ -82,7 +82,7 @@ echo "JSON Body"
cat body.json

echo "Creating Github release"
curl \
curl --fail-with-body \
-X POST https://api.github.com/repos/checkstyle/checkstyle/releases \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token $GITHUB_TOKEN" \
Expand Down
4 changes: 2 additions & 2 deletions .ci/release-upload-all-jar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ mvn -e --no-transfer-progress -Passembly,no-validations package

echo "Publishing 'all' jar to Github"
UPLOAD_LINK=https://uploads.github.com/repos/checkstyle/checkstyle/releases
RELEASE_ID=$(curl -s -X GET \
RELEASE_ID=$(curl --fail-with-body -s -X GET \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/checkstyle/checkstyle/releases/tags/checkstyle-"$TARGET_VERSION" \
| jq ".id")


curl -i -H "Authorization: token $GITHUB_TOKEN" \
curl --fail-with-body -i -H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/java-archive" \
--data-binary @"target/checkstyle-$TARGET_VERSION-all.jar" \
-X POST "$UPLOAD_LINK"/"$RELEASE_ID"/assets?name=checkstyle-"$TARGET_VERSION"-all.jar
Expand Down
2 changes: 1 addition & 1 deletion .ci/releasenotes-gen-xdoc-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ else
fi

cd .ci-temp/checkstyle
LATEST_RELEASE_TAG=$(curl -s -H "Authorization: token $READ_ONLY_TOKEN" \
LATEST_RELEASE_TAG=$(curl --fail-with-body -s -H "Authorization: token $READ_ONLY_TOKEN" \
https://api.github.com/repos/checkstyle/checkstyle/releases/latest \
| jq ".tag_name")
echo LATEST_RELEASE_TAG="$LATEST_RELEASE_TAG"
Expand Down
2 changes: 1 addition & 1 deletion .ci/run-link-check-plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e
pwd
uname -a
mvn --version
curl -I https://sourceforge.net/projects/checkstyle/
curl --fail-with-body -I https://sourceforge.net/projects/checkstyle/
mvn -e --no-transfer-progress clean site -Dcheckstyle.ant.skip=true -DskipTests -DskipITs \
-Dpmd.skip=true -Dspotbugs.skip=true -Djacoco.skip=true -Dcheckstyle.skip=true
echo "------------ grep of linkcheck.html--BEGIN"
Expand Down
4 changes: 2 additions & 2 deletions .ci/set-milestone-on-referenced-issue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if [ -z "$ISSUE_NUMBERS" ]; then
fi

echo "Fetching latest milestone."
MILESTONE=$(curl -s \
MILESTONE=$(curl --fail-with-body -s \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN"\
https://api.github.com/repos/checkstyle/checkstyle/milestones)
Expand All @@ -50,7 +50,7 @@ function setMilestoneOnIssue {
ISSUE_NUMBER=$1
echo "Setting milestone $MILESTONE_TITLE to issue #$ISSUE_NUMBER."
BODY="{\"milestone\": $MILESTONE_NUMBER}"
curl -s \
curl --fail-with-body -s \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN"\
Expand Down
4 changes: 2 additions & 2 deletions .ci/test-spelling-unknown-words.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ if [ ! -e "$dict" ]; then
# english.words is taken from rpm:
# https://rpmfind.net/linux/fedora/linux/development/rawhide/Everything/aarch64/os/Packages/w/"
# "words-.*.noarch.rpm"
curl -k https://checkstyle.sourceforge.io/reports/english.words -o $dict
curl --fail-with-body -k https://checkstyle.sourceforge.io/reports/english.words -o $dict
fi

if [ ! -e "$word_splitter" ]; then
echo "Retrieve w"
w_location='https://raw.githubusercontent.com/jsoref/spelling/master/w'
curl -s "$w_location" |\
curl --fail-with-body -s "$w_location" |\
perl -p -n -e "s</usr/share/dict/words><$dict>" > "$word_splitter"
get_word_splitter_status="${PIPESTATUS[0]} ${PIPESTATUS[1]}"
if [ "$get_word_splitter_status" != '0 0' ]; then
Expand Down
4 changes: 2 additions & 2 deletions .ci/update-github-milestone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ TARGET_VERSION=$1
echo TARGET_VERSION="$TARGET_VERSION"

echo "Updating milestone at github"
MILESTONE_ID=$(curl -s \
MILESTONE_ID=$(curl --fail-with-body -s \
-H "Authorization: token $GITHUB_TOKEN" \
-X GET https://api.github.com/repos/checkstyle/checkstyle/milestones?state=open \
| jq ".[0] | .number")

echo TARGET_VERSION="$TARGET_VERSION"
echo MILESTONE_ID="$MILESTONE_ID"

curl \
curl --fail-with-body \
-X PATCH https://api.github.com/repos/checkstyle/checkstyle/milestones/"$MILESTONE_ID" \
-H "Authorization: token $GITHUB_TOKEN" \
-d "{ \"title\": \"$TARGET_VERSION\" }"
2 changes: 1 addition & 1 deletion .github/workflows/check-pr-description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/no-old-refs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ concurrency:
jobs:
check_issues:
if: github.repository == 'checkstyle/checkstyle'
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Download checkstyle
uses: actions/checkout@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ concurrency:
jobs:
new-milestone-and-issues-in-other-repos:
name: New Milestone, Create issues for ${{ inputs.version }}
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout the latest code
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-publish-releasenotes-twitter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ concurrency:
jobs:
publish-releasenotes-twitter:
name: Publish Release Notes on Twitter ${{ inputs.version }}
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout the latest code
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-update-github-page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ concurrency:
jobs:
update-github-page:
name: Update GitHub Page ${{ inputs.version }}
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-upload-all-jar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ concurrency:
jobs:
upload-all-jar:
name: Upload '-all' jar ${{ inputs.version }}
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout the latest code
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/releasenotes-gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
jobs:
generate:
if: github.repository == 'checkstyle/checkstyle'
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Download checkstyle
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-link-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ concurrency:
jobs:
check_issues:
if: github.repository == 'checkstyle/checkstyle'
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Download checkstyle
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/set-milestone-on-referenced-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ permissions:
jobs:
set-milestone:
if: github.repository == 'checkstyle/checkstyle'
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout the latest code
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ strategy:

# spelling
'spelling':
image: 'ubuntu-20.04'
image: 'ubuntu-22.04'
cmd: "./.ci/test-spelling-unknown-words.sh"
skipCache: true

Expand Down
16 changes: 1 addition & 15 deletions config/checkstyle-non-main-files-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,21 +154,7 @@

<!-- not a curl command but a text replacement -->
<suppress id="properCurlCommand" files=".ci[\\/]validation\.sh"/>
<!-- azure does not support this curl command -->
<suppress id="properCurlCommand" files=".ci[\\/]test-spelling-unknown-words\.sh"/>
<suppress id="properCurlCommand" files=".ci[\\/]run-link-check-plugin\.sh"/>
<!-- other images that do not support newer curl commands until #12451 -->
<!-- other images that do not support newer curl commands -->
<suppress id="properCurlCommand" files=".ci[\\/]sonar-break-build\.sh"/>
<suppress id="properCurlCommand" files=".ci[\\/]no-old-refs\.sh"/>
<suppress id="properCurlCommand" files=".ci[\\/]pr-description\.sh"/>
<suppress id="properCurlCommand" files=".ci[\\/]release-close-create-milestone\.sh"/>
<suppress id="properCurlCommand" files=".ci[\\/]release-publish-releasenotes-twitter\.sh"/>
<suppress id="properCurlCommand" files=".ci[\\/]release-upload-all-jar\.sh"/>
<suppress id="properCurlCommand" files=".ci[\\/]release-update-github-page\.sh"/>
<suppress id="properCurlCommand" files=".ci[\\/]update-github-milestone\.sh"/>
<suppress id="properCurlCommand" files=".ci[\\/]releasenotes-gen-xdoc-push\.sh"/>
<suppress id="properCurlCommand" files=".ci[\\/]release-create-issues-in-other-repos\.sh"/>
<suppress id="properCurlCommand" files=".ci[\\/]set-milestone-on-referenced-issue\.sh"/>
<suppress id="properCurlCommand" files="release\.sh"/>

</suppressions>

0 comments on commit 08c41a9

Please sign in to comment.