Problem with pipeline script

Hello everyone,

I am trying to create a pipeline to run a certain .py app and a dockerfile aswell
and I cant seem to execute either of them… I spent quite some time trying to search online and have not found anything yet.

Any help is appreciated,

pipeline {
agent any

stages {
    stage('1') {
        steps {
            git 'https://github.com/awakzdev/WorldofGames'
        }
    }
    stage('2') {
        steps {
            sh '''pwd
            ls -l'''
        }
    }
    stage('3') {
        steps {
            sh "chmod +x -R ${env.WORKSPACE}"
        }
    }
    stage('4') {
            steps {
                sh '''#!/bin/sh
                /var/jenkins_home/workspace/first-k8-pipeline/test.py'''
        }
    }
}

}

Some general guidance:

  1. Don’t place the path of the workspace in your script that runs test.py. Jenkins will manage the location of the workspace. Use relative paths like ‘./test.py’ instead of absolute paths like ‘/var/jenkins_home/workspace/first-k8-pipeline/test.py’
  2. Configure the controller with 0 executors and run all jobs on agents. Running a job on the controller gives the job full access to the controller file system
  3. Be sure the test.py script is valid python. The error message hints that it may not be a valid python script
  4. Consider running the python script with the python interpreter ‘python test.py’