Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ sudo: false

language: generic

services:
- docker

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

addons:
apt:
packages:
- docker-ce

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

before_install:
- source functions.sh && images_updated $TRAVIS_COMMIT_RANGE || tests_updated $TRAVIS_COMMIT_RANGE || travis_terminate

script: ./test-build.sh $NODE_VERSION $VARIANT

Expand Down
51 changes: 51 additions & 0 deletions functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,54 @@ function sort_versions() {

echo "${sorted[@]}"
}

function commit_range() {
local commit_id_end=${1}
shift
local commit_id_start=${1}

if [ -z "${commit_id_start}" ]; then
if [ -z "${commit_id_end}" ]; then
echo "HEAD~1..HEAD"
elif [[ "${commit_id_end}" =~ .. ]]; then
echo "${commit_id_end}"
else
echo "${commit_id_end}~1..${commit_id_end}"
fi
else
echo "${commit_id_end}..${commit_id_start}"
fi
}

function images_updated() {
local commit_range
local versions
local images_changed

commit_range="$(commit_range "$@")"

IFS=' ' read -ra versions <<<"$(
IFS=','
get_versions
)"
images_changed=$(git diff --name-only "${commit_range}" "${versions[@]}")

if [ -z "${images_changed}" ]; then
return 1
fi
return 0
}

function tests_updated() {
local commit_range
local test_changed

commit_range="$(commit_range "$@")"

test_changed=$(git diff --name-only "${commit_range}" test*)

if [ -z "${test_changed}" ]; then
return 1
fi
return 0
}
18 changes: 1 addition & 17 deletions generate-stackbrew-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,6 @@ UPSTREAM_SLUG="docker-library/${REPO_NAME}"
DOCKER_SLUG="nodejs/docker-node"
gitpath="../${REPO_NAME}"

function updated() {
local versions
local images_changed

IFS=' ' read -ra versions <<<"$(
IFS=','
get_versions
)"
images_changed=$(git diff --name-only "${COMMIT_ID}".."${COMMIT_ID}"~1 "${versions[@]}")

if [ -z "${images_changed}" ]; then
return 1
fi
return 0
}

function auth_header() {
echo "Authorization: token ${GITHUB_API_TOKEN}"
}
Expand Down Expand Up @@ -104,7 +88,7 @@ function comment_payload() {
}"
}

if updated; then
if images_updated "${COMMIT_ID}"; then

permission_check

Expand Down
8 changes: 2 additions & 6 deletions travis.yml.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@ sudo: false

language: generic

services:
- docker
addons:
apt:
packages:
- docker-ce
before_install:
- source functions.sh && images_updated $TRAVIS_COMMIT_RANGE || tests_updated $TRAVIS_COMMIT_RANGE || travis_terminate

script: ./test-build.sh $NODE_VERSION $VARIANT

Expand Down