- stage('Create k8s cluster') {
- steps {
- sh "/robot-systest/cloud-scripts/create-k8s.sh"
- sh "cat /robot-systest/results/k8s_environment.rc"
- }
- }
- stage('Install OSM') {
- steps {
- sh "/robot-systest/cloud-scripts/create-osm-vm.sh"
- sh "cat /robot-systest/results/osm_environment.rc"
- sh ". /robot-systest/results/osm_environment.rc ; /robot-systest/cloud-scripts/remote-install-osm.sh"
- }
- }
- stage('Add VIM and K8s cluster to OSM') {
- steps {
- sh """
- . /robot-systest/results/osm_environment.rc ; \
- . /robot-systest/results/k8s_environment.rc ; \
- osm version ; \
- set +x; \
- export AZURE_CLIENT_ID=\$(cat ~/azure-creds.json | jq -r .clientId | sed s/[{}]//g) ; \
- export AZURE_SECRET=\$(cat ~/azure-creds.json | jq -r .clientSecret) ; \
- export AZURE_TENANT=\$(cat ~/azure-creds.json | jq -r .tenantId) ; \
- export AZURE_SUBSCRIPTION_ID=\$(cat ~/azure-creds.json | jq -r .subscriptionId) ; \
- /robot-systest/cloud-scripts/add-vim-and-k8scluster.sh
- """
- }
-
- }
- stage('Run Robot tests') {
- steps {
- sh """
- . /robot-systest/results/osm_environment.rc ; \
- . /robot-systest/results/k8s_environment.rc ; \
- /robot-systest/run_test.sh -t ${params.ROBOT_RUN_TAG}
- """
- }
+ // Azure credentials
+ withCredentials([file(credentialsId: "${params.AZURE_CREDENTIALS}", variable: 'FILE')]) {
+ sh "cp ${FILE} ~/azure-creds.json"
+ sh """
+ set +x; \
+ AZURE_CLIENT_ID=\$(cat ~/azure-creds.json | jq -r .clientId | sed s/[{}]//g) ; \
+ AZURE_SECRET=\$(cat ~/azure-creds.json | jq -r .clientSecret) ; \
+ AZURE_TENANT=\$(cat ~/azure-creds.json | jq -r .tenantId) ; \
+ az login --service-principal --username \$AZURE_CLIENT_ID --password \$AZURE_SECRET --tenant \$AZURE_TENANT
+ """
+ sh "az vm list -o table"