mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
Use an image with pre-installed oc/kubectl/ibmcloud for IBM Pipelines (#5269)
* Use an image with pre-installed oc/kubectl/ibmcloud for IBM Pipelines * Increase time for unit tests (very long on single CPU VM) * Dockerfile for build image
This commit is contained in:
14
.ibm/images/Dockerfile
Normal file
14
.ibm/images/Dockerfile
Normal file
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user