mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
Fix windows script to use correct API KEY (#5512)
* fix windows script to use correct API KEY Signed-off-by: anandrkskd <anandrkskd@gmail.com> * remove github login Signed-off-by: anandrkskd <anandrkskd@gmail.com> * k8s updated qe key Signed-off-by: anandrkskd <anandrkskd@gmail.com> * use serviceid API key Signed-off-by: anandrkskd <anandrkskd@gmail.com> * update save_log func Signed-off-by: anandrkskd <anandrkskd@gmail.com> * make script executable Signed-off-by: anandrkskd <anandrkskd@gmail.com>
This commit is contained in:
committed by
GitHub
parent
63a5dcea99
commit
575d9ce7d6
@@ -11,17 +11,17 @@ save_logs() {
|
|||||||
apt update
|
apt update
|
||||||
apt install jq colorized-logs --yes
|
apt install jq colorized-logs --yes
|
||||||
|
|
||||||
ansi2html < "/tmp/${LOGFILE}" > "/tmp/${LOGFILE}.html"
|
ansi2html <"/tmp/${LOGFILE}" >"/tmp/${LOGFILE}.html"
|
||||||
ansi2txt < "/tmp/${LOGFILE}" > "/tmp/${LOGFILE}.txt"
|
ansi2txt <"/tmp/${LOGFILE}" >"/tmp/${LOGFILE}.txt"
|
||||||
|
|
||||||
ibmcloud target -g "${IBM_RESOURCE_GROUP}"
|
ibmcloud login --apikey "${API_KEY}"
|
||||||
|
ibmcloud target -g "${IBM_RESOURCE_GROUP}" -r "${IBM_REGION}"
|
||||||
CRN=$(ibmcloud resource service-instance ${IBM_COS} --output json | jq -r .[0].guid)
|
CRN=$(ibmcloud resource service-instance ${IBM_COS} --output json | jq -r .[0].guid)
|
||||||
ibmcloud cos config crn --crn "${CRN}"
|
ibmcloud cos config crn --crn "${CRN}"
|
||||||
|
|
||||||
ibmcloud cos upload --bucket "${IBM_BUCKET}" --key "${LOGFILE}.html" --file "/tmp/${LOGFILE}.html"
|
ibmcloud cos upload --bucket "${IBM_BUCKET}" --key "${LOGFILE}.html" --file "/tmp/${LOGFILE}.html"
|
||||||
ibmcloud cos upload --bucket "${IBM_BUCKET}" --key "${LOGFILE}.txt" --file "/tmp/${LOGFILE}.txt"
|
ibmcloud cos upload --bucket "${IBM_BUCKET}" --key "${LOGFILE}.txt" --file "/tmp/${LOGFILE}.txt"
|
||||||
|
|
||||||
echo -n ${GITHUB_TOKEN} | gh auth login --with-token
|
|
||||||
BASE_URL="https://s3.${IBM_REGION}.cloud-object-storage.appdomain.cloud/${IBM_BUCKET}"
|
BASE_URL="https://s3.${IBM_REGION}.cloud-object-storage.appdomain.cloud/${IBM_BUCKET}"
|
||||||
if [[ $RESULT == "0" ]]; then
|
if [[ $RESULT == "0" ]]; then
|
||||||
STATUS="successfully"
|
STATUS="successfully"
|
||||||
@@ -38,12 +38,10 @@ EOF
|
|||||||
# with values: "team: odo" and "type: testing"
|
# with values: "team: odo" and "type: testing"
|
||||||
cleanup_namespaces() {
|
cleanup_namespaces() {
|
||||||
PROJECTS=$(kubectl get cm -A | grep config-map-for-cleanup | awk '{ print $1 }')
|
PROJECTS=$(kubectl get cm -A | grep config-map-for-cleanup | awk '{ print $1 }')
|
||||||
for PROJECT in ${PROJECTS}
|
for PROJECT in ${PROJECTS}; do
|
||||||
do
|
|
||||||
TEAM=$(kubectl get configmaps config-map-for-cleanup -n ${PROJECT} -o jsonpath='{.data.team}')
|
TEAM=$(kubectl get configmaps config-map-for-cleanup -n ${PROJECT} -o jsonpath='{.data.team}')
|
||||||
TYPE=$(kubectl get configmaps config-map-for-cleanup -n ${PROJECT} -o jsonpath='{.data.type}')
|
TYPE=$(kubectl get configmaps config-map-for-cleanup -n ${PROJECT} -o jsonpath='{.data.type}')
|
||||||
if [[ "${TYPE}" -eq "testing" ]] && [[ "${TEAM}" -eq "odo" ]]
|
if [[ "${TYPE}" -eq "testing" ]] && [[ "${TEAM}" -eq "odo" ]]; then
|
||||||
then
|
|
||||||
kubectl delete namespace ${PROJECT} --wait=false
|
kubectl delete namespace ${PROJECT} --wait=false
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
2
.ibm/pipelines/kubernetes-tests.sh
Normal file → Executable file
2
.ibm/pipelines/kubernetes-tests.sh
Normal file → Executable file
@@ -4,7 +4,7 @@ LOGFILE="pr-${GIT_PR_NUMBER}-kubernetes-tests-${BUILD_NUMBER}"
|
|||||||
|
|
||||||
source .ibm/pipelines/functions.sh
|
source .ibm/pipelines/functions.sh
|
||||||
|
|
||||||
ibmcloud login --apikey "${API_KEY}"
|
ibmcloud login --apikey "${API_KEY_QE}"
|
||||||
ibmcloud target -r "${IBM_REGION}"
|
ibmcloud target -r "${IBM_REGION}"
|
||||||
ibmcloud ks cluster config --cluster "${IBM_KUBERNETES_ID}" --admin
|
ibmcloud ks cluster config --cluster "${IBM_KUBERNETES_ID}" --admin
|
||||||
|
|
||||||
|
|||||||
4
.ibm/pipelines/openshift-tests.sh
Normal file → Executable file
4
.ibm/pipelines/openshift-tests.sh
Normal file → Executable file
@@ -4,7 +4,7 @@ LOGFILE="pr-${GIT_PR_NUMBER}-openshift-tests-${BUILD_NUMBER}"
|
|||||||
|
|
||||||
source .ibm/pipelines/functions.sh
|
source .ibm/pipelines/functions.sh
|
||||||
|
|
||||||
oc login -u apikey -p "${API_KEY}" "${IBM_OPENSHIFT_ENDPOINT}"
|
oc login -u apikey -p "${API_KEY_QE}" "${IBM_OPENSHIFT_ENDPOINT}"
|
||||||
|
|
||||||
cleanup_namespaces
|
cleanup_namespaces
|
||||||
|
|
||||||
@@ -20,8 +20,6 @@ cleanup_namespaces
|
|||||||
) |& tee "/tmp/${LOGFILE}"
|
) |& tee "/tmp/${LOGFILE}"
|
||||||
RESULT=${PIPESTATUS[0]}
|
RESULT=${PIPESTATUS[0]}
|
||||||
|
|
||||||
ibmcloud login --apikey "${API_KEY}"
|
|
||||||
ibmcloud target -r "${IBM_REGION}"
|
|
||||||
save_logs "${LOGFILE}" "OpenShift Tests" ${RESULT}
|
save_logs "${LOGFILE}" "OpenShift Tests" ${RESULT}
|
||||||
|
|
||||||
exit ${RESULT}
|
exit ${RESULT}
|
||||||
|
|||||||
2
.ibm/pipelines/unit-tests.sh
Normal file → Executable file
2
.ibm/pipelines/unit-tests.sh
Normal file → Executable file
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Script to run unit test on IBM Cloud
|
# Script to run unit test on IBM Cloud
|
||||||
# This script needs update if there is any change in the unit test make target command
|
# This script needs update if there is any change in the unit test make target command
|
||||||
|
|
||||||
LOGFILE="pr-${GIT_PR_NUMBER}-unit-tests-${BUILD_NUMBER}"
|
LOGFILE="pr-${GIT_PR_NUMBER}-unit-tests-${BUILD_NUMBER}"
|
||||||
|
|||||||
2
.ibm/pipelines/validate.sh
Normal file → Executable file
2
.ibm/pipelines/validate.sh
Normal file → Executable file
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Script to run validate test on IBM Cloud
|
# Script to run validate test on IBM Cloud
|
||||||
# This script needs update if there is any change in steps of executing validate test
|
# This script needs update if there is any change in steps of executing validate test
|
||||||
|
|
||||||
LOGFILE="pr-${GIT_PR_NUMBER}-Validate-tests-${BUILD_NUMBER}"
|
LOGFILE="pr-${GIT_PR_NUMBER}-Validate-tests-${BUILD_NUMBER}"
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ function Run-Test {
|
|||||||
|
|
||||||
|
|
||||||
Shout "Login Openshift"
|
Shout "Login Openshift"
|
||||||
oc login -u apikey -p ${API_KEY_QE} ${IBM_OPENSHIFT_ENDPOINT}
|
oc login -u apikey -p ${API_KEY} ${IBM_OPENSHIFT_ENDPOINT}
|
||||||
|
|
||||||
Shout "Create Binary"
|
Shout "Create Binary"
|
||||||
make install
|
make install
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
###################################################
|
###################################################
|
||||||
# This script is used to run the test on windows
|
# This script is used to run the test on windows
|
||||||
@@ -10,20 +10,20 @@ set -x
|
|||||||
LOGFILE="pr-${GIT_PR_NUMBER}-windows-tests-${BUILD_NUMBER}"
|
LOGFILE="pr-${GIT_PR_NUMBER}-windows-tests-${BUILD_NUMBER}"
|
||||||
export REPO=${REPO:-"https://github.com/redhat-developer/odo"}
|
export REPO=${REPO:-"https://github.com/redhat-developer/odo"}
|
||||||
#copy test script inside /tmp/
|
#copy test script inside /tmp/
|
||||||
sshpass -p $WINDOWS_PASSWORD scp -o StrictHostKeyChecking=no ./.ibm/pipelines/windows-test-script.ps1 Administrator@$WINDOWS_IP:/tmp/windows-test-script.ps1
|
sshpass -p $WINDOWS_PASSWORD scp -o StrictHostKeyChecking=no ./.ibm/pipelines/windows-test-script.ps1 Administrator@$WINDOWS_IP:/tmp/windows-test-script.ps1
|
||||||
|
|
||||||
#execute test from the test script
|
#execute test from the test script
|
||||||
sshpass -p $WINDOWS_PASSWORD ssh Administrator@$WINDOWS_IP -o StrictHostKeyChecking=no powershell /tmp/windows-test-script.ps1 "${GIT_PR_NUMBER}" "${BUILD_NUMBER}" "${API_KEY}" "${IBM_OPENSHIFT_ENDPOINT}" "${LOGFILE}" "${REPO}"
|
sshpass -p $WINDOWS_PASSWORD ssh Administrator@$WINDOWS_IP -o StrictHostKeyChecking=no powershell /tmp/windows-test-script.ps1 "${GIT_PR_NUMBER}" "${BUILD_NUMBER}" "${API_KEY_QE}" "${IBM_OPENSHIFT_ENDPOINT}" "${LOGFILE}" "${REPO}"
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
echo "RESULT: $RESULT"
|
echo "RESULT: $RESULT"
|
||||||
|
|
||||||
# save log
|
# save log
|
||||||
source .ibm/pipelines/functions.sh
|
source .ibm/pipelines/functions.sh
|
||||||
ibmcloud login --apikey "${API_KEY}" -r "${IBM_REGION}"
|
ibmcloud login --apikey "${API_KEY}" -r "${IBM_REGION}"
|
||||||
sshpass -p $WINDOWS_PASSWORD scp -o StrictHostKeyChecking=no Administrator@$WINDOWS_IP:/tmp/${LOGFILE} /tmp/${LOGFILE}
|
sshpass -p $WINDOWS_PASSWORD scp -o StrictHostKeyChecking=no Administrator@$WINDOWS_IP:/tmp/${LOGFILE} /tmp/${LOGFILE}
|
||||||
save_logs "${LOGFILE}" "Windows Tests (OCP)" $RESULT
|
save_logs "${LOGFILE}" "Windows Tests (OCP)" $RESULT
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
sshpass -p $WINDOWS_PASSWORD ssh Administrator@$WINDOWS_IP -o StrictHostKeyChecking=no rm -rf /tmp/windows-test-script.ps1
|
sshpass -p $WINDOWS_PASSWORD ssh Administrator@$WINDOWS_IP -o StrictHostKeyChecking=no rm -rf /tmp/windows-test-script.ps1
|
||||||
|
|
||||||
exit ${RESULT}
|
exit ${RESULT}
|
||||||
|
|||||||
Reference in New Issue
Block a user