diff --git a/.ibm/images/Dockerfile b/.ibm/images/Dockerfile new file mode 100644 index 000000000..ec452dbbe --- /dev/null +++ b/.ibm/images/Dockerfile @@ -0,0 +1,14 @@ +FROM golang:1.16 + +RUN curl -fsSL https://clis.cloud.ibm.com/install/linux | sh && \ + ibmcloud plugin install -f cloud-object-storage && \ + ibmcloud plugin install -f kubernetes-service && \ + curl -sLO https://github.com/cli/cli/releases/download/v2.1.0/gh_2.1.0_linux_amd64.deb && \ + apt install ./gh_2.1.0_linux_amd64.deb && \ + curl -sLO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && \ + chmod +x kubectl && \ + mv kubectl /usr/local/bin/ && \ + curl -sLO https://raw.githubusercontent.com/cptmorgan-rh/install-oc-tools/master/install-oc-tools.sh > /dev/null && \ + chmod +x install-oc-tools.sh && \ + ./install-oc-tools.sh --latest 4.7 + diff --git a/.ibm/pipelines/functions.sh b/.ibm/pipelines/functions.sh index d246cb71d..1f185284b 100644 --- a/.ibm/pipelines/functions.sh +++ b/.ibm/pipelines/functions.sh @@ -1,35 +1,3 @@ -# Install the ibmcloud cli, -# install the plugins passed as parameters -# and connect to the Cloud -# Env vars: -# API_KEY: IBM Cloud API Key -# IBM_REGION: IBM Cloud region -install_ibmcloud() { - curl -fsSL https://clis.cloud.ibm.com/install/linux | sh - for plugin in "$@" - do - ibmcloud plugin install -f "${plugin}" - done - ibmcloud login --apikey "${API_KEY}" -r "${IBM_REGION}" -} - -install_kubectl() { - curl -sLO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl - chmod +x kubectl - mv kubectl /usr/local/bin/ -} - -install_oc() { - curl -sLO https://raw.githubusercontent.com/cptmorgan-rh/install-oc-tools/master/install-oc-tools.sh > /dev/null - chmod +x install-oc-tools.sh - ./install-oc-tools.sh --latest 4.7 -} - -install_gh() { - curl -sLO https://github.com/cli/cli/releases/download/v2.1.0/gh_2.1.0_linux_amd64.deb - apt install ./gh_2.1.0_linux_amd64.deb -} - # Save the logs from the file passed as parameter #1 # and send a message to GitHub PR using parameter #2 as name of test # Env vars: diff --git a/.ibm/pipelines/kubernetes-tests.sh b/.ibm/pipelines/kubernetes-tests.sh index ee600aeb6..7df1735e7 100644 --- a/.ibm/pipelines/kubernetes-tests.sh +++ b/.ibm/pipelines/kubernetes-tests.sh @@ -4,12 +4,9 @@ LOGFILE="pr-${GIT_PR_NUMBER}-kubernetes-tests-${BUILD_NUMBER}" source .ibm/pipelines/functions.sh -install_ibmcloud cloud-object-storage kubernetes-service - +ibmcloud login --apikey "${API_KEY}" -r "${IBM_REGION}" ibmcloud ks cluster config --cluster "${IBM_KUBERNETES_ID}" --admin -install_kubectl - ( set -e make install @@ -19,7 +16,6 @@ install_kubectl ) |& tee "/tmp/${LOGFILE}" RESULT=${PIPESTATUS[0]} -install_gh save_logs "${LOGFILE}" "Kubernetes Tests" exit ${RESULT} diff --git a/.ibm/pipelines/openshift-tests.sh b/.ibm/pipelines/openshift-tests.sh index a1ffa5ade..105bd9f43 100644 --- a/.ibm/pipelines/openshift-tests.sh +++ b/.ibm/pipelines/openshift-tests.sh @@ -4,8 +4,6 @@ LOGFILE="pr-${GIT_PR_NUMBER}-openshift-tests-${BUILD_NUMBER}" source .ibm/pipelines/functions.sh -install_oc - oc login -u apikey -p "${API_KEY}" "${IBM_OPENSHIFT_ENDPOINT}" ( @@ -20,8 +18,7 @@ oc login -u apikey -p "${API_KEY}" "${IBM_OPENSHIFT_ENDPOINT}" ) |& tee "/tmp/${LOGFILE}" RESULT=${PIPESTATUS[0]} -install_ibmcloud cloud-object-storage -install_gh +ibmcloud login --apikey "${API_KEY}" -r "${IBM_REGION}" save_logs "${LOGFILE}" "OpenShift Tests" exit ${RESULT} diff --git a/.ibm/pipelines/unit-tests.sh b/.ibm/pipelines/unit-tests.sh index 6065a8e0f..e60d148af 100644 --- a/.ibm/pipelines/unit-tests.sh +++ b/.ibm/pipelines/unit-tests.sh @@ -12,8 +12,7 @@ source .ibm/pipelines/functions.sh ) |& tee "/tmp/$LOGFILE" RESULT=${PIPESTATUS[0]} -install_ibmcloud cloud-object-storage -install_gh +ibmcloud login --apikey "${API_KEY}" -r "${IBM_REGION}" save_logs "${LOGFILE}" "Unit Tests" exit ${RESULT} diff --git a/Makefile b/Makefile index a186b9db4..142b14957 100644 --- a/Makefile +++ b/Makefile @@ -86,7 +86,7 @@ validate-vendor-licenses: .PHONY: golint golint: - golangci-lint run ./... --timeout 5m + golangci-lint run ./... --timeout 15m .PHONY: lint lint: ## golint errors are only recommendations