diff --git a/1.10/.exclude-fedora b/1.10/.exclude-fedora new file mode 100644 index 0000000..e69de29 diff --git a/1.12/s2i/bin/assemble b/1.12/s2i/bin/assemble index 989508b..74d473a 100755 --- a/1.12/s2i/bin/assemble +++ b/1.12/s2i/bin/assemble @@ -19,6 +19,7 @@ if [[ `go list -f {{.Incomplete}}` == "true" || ! -z "$IMPORT_URL" ]]; then mkdir -p "$GOPATH/src/$IMPORT_URL" shopt -s dotglob + mv /tmp/src/* "$GOPATH/src/$IMPORT_URL" if [[ -d "/tmp/artifacts/pkg" ]] || [[ -d "/tmp/artifacts/go-build" ]]; then @@ -54,7 +55,7 @@ if [[ `go list -f {{.Incomplete}}` == "true" || ! -z "$IMPORT_URL" ]]; then go install "$INSTALL_URL" - mv "$GOPATH/bin/*" /opt/app-root/gobinary + mv $GOPATH/bin/* /opt/app-root/gobinary popd diff --git a/1.8/.exclude-fedora b/1.8/.exclude-fedora new file mode 100644 index 0000000..e69de29 diff --git a/1.9/.exclude-fedora b/1.9/.exclude-fedora new file mode 100644 index 0000000..e69de29 diff --git a/Makefile b/Makefile index 58559d9..044e5bd 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Include common Makefile code. BASE_IMAGE_NAME = golang -VERSIONS = 1.12 +VERSIONS = 1.8 1.9 1.10 1.11 1.12 OPENSHIFT_NAMESPACES = # HACK: Ensure that 'git pull' for old clones doesn't cause confusion. diff --git a/README.md b/README.md index b218d72..2e33db1 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,9 @@ Versions --------------- Golang versions currently provided are: * [Golang 1.8 (go-toolset 7, where applicable)](1.8) +* [Golang 1.9](1.9) +* [Golang 1.10](1.10) +* [Golang 1.11](1.11) * [Golang 1.12](1.12) RHEL versions currently supported are: diff --git a/common b/common index 8ce808b..a17b923 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 8ce808b004765d7040b3777ed47a82d8aede215b +Subproject commit a17b923948ecbc6164d0273163ab83e5266b5b2c diff --git a/test/complete-app/s2i-build b/test/complete-app/s2i-build deleted file mode 100755 index 78854c1..0000000 --- a/test/complete-app/s2i-build +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -s2i build -e IMPORT_URL='complete-app' ${s2i_args} file://./app ${IMAGE_NAME} ${IMAGE_NAME}-testapp diff --git a/test/complete-app/s2i-build-incremental b/test/complete-app/s2i-build-incremental deleted file mode 100755 index 2f1034f..0000000 --- a/test/complete-app/s2i-build-incremental +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -s2i build --incremental -e IMPORT_URL='complete-app' ${s2i_args} file://./app ${IMAGE_NAME} ${IMAGE_NAME}-testapp diff --git a/test/import-with-vendor-app/s2i-build b/test/import-with-vendor-app/s2i-build deleted file mode 100755 index 8522f4d..0000000 --- a/test/import-with-vendor-app/s2i-build +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' ${s2i_args} file://./app ${IMAGE_NAME} ${IMAGE_NAME}-testapp diff --git a/test/import-with-vendor-app/s2i-build-incremental b/test/import-with-vendor-app/s2i-build-incremental deleted file mode 100755 index d5ec323..0000000 --- a/test/import-with-vendor-app/s2i-build-incremental +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -s2i build --incremental -e IMPORT_URL='github.com/cpuguy83/go-md2man' ${s2i_args} file://./app ${IMAGE_NAME} ${IMAGE_NAME}-testapp diff --git a/test/import-without-vendor-app/s2i-build b/test/import-without-vendor-app/s2i-build deleted file mode 100755 index 8522f4d..0000000 --- a/test/import-without-vendor-app/s2i-build +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' ${s2i_args} file://./app ${IMAGE_NAME} ${IMAGE_NAME}-testapp diff --git a/test/import-without-vendor-app/s2i-build-incremental b/test/import-without-vendor-app/s2i-build-incremental deleted file mode 100755 index d5ec323..0000000 --- a/test/import-without-vendor-app/s2i-build-incremental +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -s2i build --incremental -e IMPORT_URL='github.com/cpuguy83/go-md2man' ${s2i_args} file://./app ${IMAGE_NAME} ${IMAGE_NAME}-testapp diff --git a/test/run b/test/run index 3845c17..5db6cae 100755 --- a/test/run +++ b/test/run @@ -6,13 +6,22 @@ # IMAGE_NAME specifies a name of the candidate image used for testing. # The image has to be available before this script is executed. # + export IMAGE_NAME=${IMAGE_NAME:-centos/go-toolset-7-centos7} +test -n $IMAGE_NAME \ + -a -n $VERSION + declare -a TEST_APPS=({simple,import-with-vendor,import-without-vendor,complete}-app) +s2i_args="--pull-policy=never " + # TODO: Make command compatible for Mac users -test_dir="$(readlink -zf $(dirname "${BASH_SOURCE[0]}"))" -image_dir=$(readlink -zf ${test_dir}/..) +test_dir="$(readlink -f $(dirname "${BASH_SOURCE[0]}"))" +image_dir=$(readlink -f ${test_dir}/..) +cid_file=$(mktemp -u --suffix=.cid) + +source "${test_dir}/test-lib.sh" info() { echo -e "\n\e[1m[INFO] $@\e[0m\n" @@ -32,9 +41,7 @@ container_ip() { run_s2i_build() { info "Building the ${1} application image ..." - pushd ${test_dir}/${1} >/dev/null - ./s2i-build - popd + ct_s2i_build_as_df file://${test_dir}/${1}/app ${IMAGE_NAME} ${IMAGE_NAME}-testapp ${s2i_args} ${2} $(ct_build_s2i_npm_variables) } incremental_test_clean_up(){ @@ -45,9 +52,9 @@ incremental_test_clean_up(){ run_s2i_build_incremental(){ info "Building the ${1} application image using incremental build ..." - pushd ${test_dir}/${1} >/dev/null - ./s2i-build-incremental &>run1 - ./s2i-build-incremental &>run2 + npm_variables=$(ct_build_s2i_npm_variables) + ct_s2i_build_as_df file://${test_dir}/${1}/app ${IMAGE_NAME} ${IMAGE_NAME}-testapp ${s2i_args} ${2} ${npm_variables} --incremental &>run1 + ct_s2i_build_as_df file://${test_dir}/${1}/app ${IMAGE_NAME} ${IMAGE_NAME}-testapp ${s2i_args} ${2} ${npm_variables} --incremental &>run2 if grep "Clean build will be performed because of error saving previous build artifacts" run2; then cat run2 info "Incremental build, artifact injection failed..." @@ -63,8 +70,6 @@ run_s2i_build_incremental(){ fi incremental_test_clean_up - - popd } prepare() { @@ -130,12 +135,12 @@ wait_for_cid() { test_s2i_usage() { info "Testing 's2i usage' ..." - s2i usage ${s2i_args} ${IMAGE_NAME} + ct_s2i_usage ${IMAGE_NAME} ${s2i_args} &>/dev/null } test_docker_run_usage() { info "Testing 'docker run' usage ..." - docker run ${IMAGE_NAME} + docker run --rm ${IMAGE_NAME} &>/dev/null } test_scl_usage() { @@ -177,26 +182,34 @@ test_application() { # Since we built the candidate image locally, we don't want S2I attempt to pull # it from Docker hub -export s2i_args="-p never --incremental-pull-policy=never" # determine what version of the Go are we testing base on the dir we are in export EXPECTED_VER="go`pwd | awk -F "/" '{print $(NF)}'`" # Verify the 'usage' script is working properly when running the base image with 's2i usage ...' info "Testing image ${IMAGE_NAME} with go version ${EXPECTED_VER} " -test_s2i_usage -check_result $? - -# Verify the 'usage' script is working properly when running the base image with 'docker run ...' -test_docker_run_usage -check_result $? for app in ${TEST_APPS[@]}; do + if [ x"${app}" == "xcomplete-app" ]; then + import_url="-e IMPORT_URL=${app}" + elif [ x"${app}" == "xsimple-app" ]; then + import_url="" + else + import_url="-e IMPORT_URL='github.com/cpuguy83/go-md2man'" + fi prepare ${app} - run_s2i_build ${app} - if [ -e ${test_dir}/${app}/s2i-build-incremental ]; then - run_s2i_build_incremental ${app} + run_s2i_build ${app} "${import_url}" + check_result $? + if [ x"${app}" != "xsimple-app" ]; then + run_s2i_build_incremental ${app} "${import_url}" + check_result $? fi + + test_s2i_usage + check_result $? + + # Verify the 'usage' script is working properly when running the base image with 'docker run ...' + test_docker_run_usage check_result $? # test application with default user diff --git a/test/simple-app/s2i-build b/test/simple-app/s2i-build deleted file mode 100755 index b31af36..0000000 --- a/test/simple-app/s2i-build +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -s2i build file://./app ${IMAGE_NAME} ${IMAGE_NAME}-testapp diff --git a/test/test-lib.sh b/test/test-lib.sh new file mode 120000 index 0000000..6ddf876 --- /dev/null +++ b/test/test-lib.sh @@ -0,0 +1 @@ +../common/test-lib.sh \ No newline at end of file