Skip to content
CodeKruPro

Read the Jenkinsfile: how do tests get the password?

QuizMedium

Read the Jenkinsfile. staging-api-user is a "Username with password" credential stored in Jenkins.

Jenkinsfile

pipeline {
    agent any
    environment {
        API_USER = credentials('staging-api-user')
    }
    stages {
        stage('API tests') {
            steps {
                sh 'pytest tests/api --junitxml=reports/api.xml'
            }
        }
    }
    post {
        always {
            junit 'reports/*.xml'
        }
    }
}

Which statements are true? Choose all that apply.

  • The tests can read API_USER_USR (user name) and API_USER_PSW (password) from the environment
  • API_USER itself holds user:password
  • If a step prints the password, Jenkins masks it in the console log
  • The password is stored in the Git repository next to the Jenkinsfile

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in