Skip to content

Commit

Permalink
Reformatting the files in the scripts folder (#7755)
Browse files Browse the repository at this point in the history
# Description
Reformatting the files in the scripts folder

## Type of change
- This pull request is a minor refactor, code cleanup, test improvement,
or other maintenance task and doesn't change the functionality of Radius
(issue link optional).

Signed-off-by: ytimocin <ytimocin@microsoft.com>
  • Loading branch information
ytimocin committed Jul 22, 2024
1 parent 46bf036 commit 0dbbf5a
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/cleanup-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ set -e
echo "cleaning up cluster"

# Delete all test resources in queuemessages.
if kubectl get crd queuemessages.ucp.dev > /dev/null 2>&1; then
if kubectl get crd queuemessages.ucp.dev >/dev/null 2>&1; then
echo "delete all resources in queuemessages.ucp.dev"
kubectl delete queuemessages.ucp.dev -n radius-system --all
fi

# Testing deletion of deployment.apps.

# Delete all test resources in resources without proxy resource.
if kubectl get crd resources.ucp.dev > /dev/null 2>&1; then
if kubectl get crd resources.ucp.dev >/dev/null 2>&1; then
echo "delete all resources in resources.ucp.dev"
resources=$(kubectl get resources.ucp.dev -n radius-system --no-headers -o custom-columns=":metadata.name")
for r in $resources; do
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/curl-with-retries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
Expand Down
10 changes: 6 additions & 4 deletions .github/scripts/get_release_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
Expand Down Expand Up @@ -62,7 +62,8 @@

with open(os.getenv("GITHUB_ENV"), "a") as githubEnv:
if gitRef is None:
print("This is not running in github, GITHUB_REF is null. Assuming a local build...")
print(
"This is not running in github, GITHUB_REF is null. Assuming a local build...")

version = "REL_VERSION=edge"
print("Setting: {}".format(version))
Expand Down Expand Up @@ -111,7 +112,8 @@
print("Setting: {}".format(chart))
githubEnv.write(chart + "\n")

channel = "REL_CHANNEL={}.{}".format(match.group("major"), match.group("minor"))
channel = "REL_CHANNEL={}.{}".format(
match.group("major"), match.group("minor"))
print("Setting: {}".format(channel))
githubEnv.write(channel + "\n")

Expand All @@ -121,7 +123,7 @@

else:
print("This is a prerelease...")

version = "REL_VERSION={}".format(match.group("version"))
print("Setting: {}".format(version))
githubEnv.write(version + "\n")
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/release-create-tag-and-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
Expand Down
9 changes: 4 additions & 5 deletions .github/scripts/release-get-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
Expand Down Expand Up @@ -48,8 +48,7 @@ RELEASE_VERSION=""
RELEASE_BRANCH_NAME=""

pushd $REPOSITORY
for VERSION in $(echo $VERSIONS | sed "s/,/ /g")
do
for VERSION in $(echo $VERSIONS | sed "s/,/ /g"); do
# VERSION_NUMBER is the version number without the 'v' prefix (e.g. 0.1.0)
VERSION_NUMBER=$(echo $VERSION | cut -d 'v' -f 2)

Expand Down Expand Up @@ -80,5 +79,5 @@ fi

echo "Release version: ${RELEASE_VERSION}"
echo "Release branch name: ${RELEASE_BRANCH_NAME}"
echo "release-version=$RELEASE_VERSION" >> $GITHUB_OUTPUT
echo "release-branch-name=$RELEASE_BRANCH_NAME" >> $GITHUB_OUTPUT
echo "release-version=$RELEASE_VERSION" >>$GITHUB_OUTPUT
echo "release-branch-name=$RELEASE_BRANCH_NAME" >>$GITHUB_OUTPUT
4 changes: 2 additions & 2 deletions .github/scripts/release-verification.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
Expand Down Expand Up @@ -38,7 +38,7 @@ EXPECTED_CLI_VERSION=$RELEASE_VERSION_NUMBER

EXPECTED_TAG_VERSION=$RELEASE_VERSION_NUMBER
# if RELEASE_VERSION_NUMBER contains -rc, then it is a prerelease.
# In that case, we need to set expected tag version to the major.minor of the
# In that case, we need to set expected tag version to the major.minor of the
# release version number
if [[ $RELEASE_VERSION_NUMBER != *"rc"* ]]; then
EXPECTED_TAG_VERSION=$(echo $RELEASE_VERSION_NUMBER | cut -d '.' -f 1,2)
Expand Down
12 changes: 7 additions & 5 deletions .github/scripts/transform_test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
Expand All @@ -22,9 +22,11 @@
import sys
import xml.etree.ElementTree


def main():
if len(sys.argv) != 4:
print("Usage: transform-test-results.py <repository root> <input file> <output file>")
print(
"Usage: transform-test-results.py <repository root> <input file> <output file>")
sys.exit(1)

repository_root = sys.argv[1]
Expand All @@ -38,7 +40,7 @@ def main():
failure = testcase.find('./failure')
if failure is None:
continue

# Extract file name by matching regex pattern in the text
# it will look like \tError Trace:\tfilename:line
match = pattern.search(failure.text)
Expand All @@ -55,16 +57,16 @@ def main():
continue

file = file[len(repository_root) + 1:]

testcase.attrib["file"] = file
testcase.attrib["line"] = line
failure.attrib["file"] = file
failure.attrib["line"] = line


# Write back to file
print(f"Writing {output_file}")
et.write(output_file)


if __name__ == "__main__":
main()
4 changes: 3 additions & 1 deletion .github/scripts/validate_semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
Expand All @@ -20,6 +20,7 @@
import re
import sys


def main():
if len(sys.argv) != 2:
print("Usage: validate_semver.py <version>")
Expand All @@ -41,5 +42,6 @@ def main():
print("Provided version is valid semver")
sys.exit(0)


if __name__ == "__main__":
main()

0 comments on commit 0dbbf5a

Please sign in to comment.