Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Add build matrix and use full git sha
Browse files Browse the repository at this point in the history
* add a s3 build matrix for travis.ci
* use full git log sha %H instead of %h for folder name
  • Loading branch information
nanliu committed Jul 22, 2016
1 parent b8304e2 commit 1aab164
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
7 changes: 6 additions & 1 deletion .travis.yml
Expand Up @@ -16,6 +16,11 @@ env:
- SNAP_TEST_TYPE=legacy
- SNAP_TEST_TYPE=small
- SNAP_TEST_TYPE=medium
- SNAP_TEST_TYPE=build
matrix:
exclude:
- go: 1.5.4
env: SNAP_TEST_TYPE=build
install:
- export TMPDIR=$HOME/tmp
- mkdir -p $TMPDIR
Expand Down Expand Up @@ -43,6 +48,6 @@ deploy:
on:
repo: intelsdi-x/snap
branch: master
condition: $SNAP_TEST_TYPE = medium && $TRAVIS_GO_VERSION = "1.6.2"
condition: $SNAP_TEST_TYPE = build && $TRAVIS_GO_VERSION = "1.6.2"
after_deploy:
- "./scripts/post_deploy.sh"
8 changes: 2 additions & 6 deletions scripts/post_deploy.sh
Expand Up @@ -17,11 +17,6 @@
#See the License for the specific language governing permissions and
#limitations under the License.

git_branch=$(git symbolic-ref HEAD 2> /dev/null | cut -b 12-)
git_branch="${git_branch:-snap}"
git_sha=$(git log --pretty=format:"%h" -1)
git_version=$(git describe --always --exact-match 2> /dev/null || echo "${git_branch}-${git_sha}")

set -e
set -u
set -o pipefail
Expand All @@ -32,7 +27,8 @@ __proj_dir="$(dirname "$__dir")"
# shellcheck source=scripts/common.sh
. "${__dir}/common.sh"

SNAP_BUILD_URL="https://s3-us-west-2.amazonaws.com/intelsdi-x/snap/${git_version}"
git_sha=$(git log --pretty=format:"%H" -1)
SNAP_BUILD_URL="https://s3-us-west-2.amazonaws.com/intelsdi-x/snap/${git_sha}"
export SNAP_BUILD_URL

_info "updating package URL: ${SNAP_BUILD_URL}"
Expand Down
8 changes: 2 additions & 6 deletions scripts/pre_deploy.sh
Expand Up @@ -17,11 +17,6 @@
#See the License for the specific language governing permissions and
#limitations under the License.

git_branch=$(git symbolic-ref HEAD 2> /dev/null | cut -b 12-)
git_branch="${git_branch:-snap}"
git_sha=$(git log --pretty=format:"%h" -1)
git_version=$(git describe --always --exact-match 2> /dev/null || echo "${git_branch}-${git_sha}")

set -e
set -u
set -o pipefail
Expand All @@ -33,7 +28,8 @@ __proj_dir="$(dirname "$__dir")"
. "${__dir}/common.sh"

build_path="${SNAP_PATH:-"${__proj_dir}/build"}"
git_path="${build_path}/${git_version}"
git_sha=$(git log --pretty=format:"%H" -1)
git_path="${build_path}/${git_sha}"

mkdir -p "${git_path}"
_info "copying snap binaries to ${git_path}"
Expand Down
7 changes: 6 additions & 1 deletion scripts/test.sh
Expand Up @@ -38,7 +38,12 @@ export SNAP_PATH
_debug "script directory ${__dir}"
_debug "project directory ${__proj_dir}"

[[ "$SNAP_TEST_TYPE" =~ ^(small|medium|large|legacy)$ ]] || _error "invalid/missing SNAP_TEST_TYPE (value must be 'small', 'medium', 'large', or 'legacy', received:${SNAP_TEST_TYPE}"
[[ "$SNAP_TEST_TYPE" =~ ^(small|medium|large|legacy|build)$ ]] || _error "invalid/missing SNAP_TEST_TYPE (value must be 'small', 'medium', 'large', 'legacy', or 'build' received:${SNAP_TEST_TYPE}"

if [[ "${SNAP_TEST_TYPE}" == "build" ]]; then
_info "s3 builds are generated by travis.ci and only triggered by merges on master branch."
exit 0
fi

# If the following plugins don't exist, exit
[ -f $SNAP_PATH/plugin/snap-plugin-collector-mock1 ] || { _error 'Error: $SNAP_PATH/plugin/snap-plugin-collector-mock1 does not exist. Run make to build it.'; }
Expand Down

0 comments on commit 1aab164

Please sign in to comment.