添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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,

VirtualBoxVM_buknzaFEgz 1920×1080 302 KB

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:

  • 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’
  • 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
  • Be sure the test.py script is valid python. The error message hints that it may not be a valid python script
  • Consider running the python script with the python interpreter ‘python test.py’
  •