#Testing Error inside jenkins

7 messages · Page 1 of 1 (latest)

mint light
#

pipeline {
agent any

environment {
    dockerImage = ''
    registry = 'yashkhati/pythonapp'
}

stages {
    stage('Checkout') {
        steps {
            checkout scmGit(branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/Yash-codeAndDev/DevOps_PythonApp.git']])
        }
    }

    stage('Build Docker Image') {
        steps {
            script {
                // Build the Docker image from the specified directory
                
                    dockerImage = docker.build registry
                    echo "Docker image built: ${dockerImage.id}"
            }
        }
    }

    stage('Run Tests') {
        steps {
            script {
                docker.image("${dockerImage.id}").inside {
                    sh 'pytest'
                }
            }
        }
    }
    

    // Add more stages as needed, e.g., deployment, testing
}

}

i am getting error on Run Test can anyone tell me why ? Error : Jenkins does not seem to be running inside a container

queen domeBOT
#

This post has been reserved for your question.

Hey @mint light! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

queen domeBOT
tiny gyro
#

What's the error?

mint light
#

Error : Jenkins does not seem to be running inside a container

amber helm