Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #652 from chavafg/topic/url-fix-1.1
Browse files Browse the repository at this point in the history
CI: fix static-checks for stable branches
  • Loading branch information
chavafg authored Aug 27, 2018
2 parents 3bbbb57 + 561161e commit efaa618
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
7 changes: 4 additions & 3 deletions .ci/jenkins_job_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ ${GOPATH}/src/${tests_repo}/.ci/install_go.sh -p
# Run the static analysis tools
if [ -z "${METRICS_CI}" ]
then
master_branch=""
[ -z "$pr_number" ] && master_branch="true"
.ci/static-checks.sh "$kata_repo" "$master_branch"
specific_branch=""
# If not a PR, we are testing on stable or master branch.
[ -z "$pr_number" ] && specific_branch="true"
.ci/static-checks.sh "$kata_repo" "$specific_branch"
fi

if [ -n "$pr_number" ]
Expand Down
22 changes: 11 additions & 11 deletions .ci/static-checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ source "${cidir}/lib.sh"
script_name=${0##*/}

repo=""
master_branch="false"
specific_branch="false"

usage()
{
Expand All @@ -31,8 +31,8 @@ Parameters:
help : Show usage.
repo-name : GitHub URL of repo to check in form "github.com/user/repo".
true : Specify as "true" if testing the 'master' branch, else assume a
PR branch.
true : Specify as "true" if testing a specific branch (stable or master),
else assume a PR branch.
Example:
Expand Down Expand Up @@ -78,7 +78,7 @@ get_pr_changed_file_details()
-r \
--name-status \
--diff-filter="${filters}" \
origin/master HEAD | grep -v "vendor/"
"origin/${target_branch}" HEAD | grep -v "vendor/"
}

check_commits()
Expand Down Expand Up @@ -255,8 +255,8 @@ check_versions()
# Ensure all files (where possible) contain an SPDX license header
check_license_headers()
{
# The master branch is the baseline - ignore it.
[ "$master_branch" = "true" ] && return
# The branch is the baseline - ignore it.
[ "$specific_branch" = "true" ] && return

# See: https://spdx.org/licenses/Apache-2.0.html
local -r spdx_tag="SPDX-License-Identifier"
Expand Down Expand Up @@ -321,7 +321,7 @@ check_docs()
local new_urls
local url

if [ "$master_branch" = "true" ]
if [ "$specific_branch" = "true" ]
then
# Check all documents
docs=$(find . -name "*.md" | grep -v "vendor/" || true)
Expand All @@ -346,7 +346,7 @@ check_docs()
# document" *will* result in when the PR has landed
# and then check docs for that new URL and exclude
# them from the real URL check.
url="https://${repo}/blob/master/${doc}"
url="https://${repo}/blob/${target_branch}/${doc}"

new_urls+=" ${url}"
done
Expand Down Expand Up @@ -381,7 +381,7 @@ check_docs()

for url in $urls
do
if [ "$master_branch" != "true" ]
if [ "$specific_branch" != "true" ]
then
# If the URL is new on this PR, it cannot be checked.
echo "$new_urls" | grep -q "\<${url}\>" && \
Expand Down Expand Up @@ -440,7 +440,7 @@ check_files()

info "Checking files"

if [ "$master_branch" = "true" ]
if [ "$specific_branch" = "true" ]
then
files=$(find . -type f | egrep -v "(.git|vendor)/" || true)
else
Expand Down Expand Up @@ -517,7 +517,7 @@ main()
fi
fi

master_branch="$2"
specific_branch="$2"

if [ -n "$TRAVIS_BRANCH" ] && [ "$TRAVIS_BRANCH" != "master" ]
then
Expand Down
5 changes: 3 additions & 2 deletions integration/swarm/swarm.bats
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ setup() {
interfaces=$(basename -a /sys/class/net/*)
swarm_interface_arg=""
for i in ${interfaces[@]}; do
if [ "$(cat /sys/class/net/${i}/operstate)" == "up" ]; then
swarm_interface_arg="--advertise-addr ${i}"
check_ip_address=$(ip a show dev ${i} | awk '/inet / {print $2}' | cut -d'/' -f1)
if [ "$(cat /sys/class/net/${i}/operstate)" == "up" ] && [ -n "${check_ip_address}" ]; then
swarm_interface_arg="--advertise-addr ${check_ip_address}"
break;
fi
done
Expand Down

0 comments on commit efaa618

Please sign in to comment.