kubesphere / devops-agent

Agents for Kubesphere DevOps
Apache License 2.0
61 stars 73 forks source link

Add a Python Jenkins k8s agent image #31

Closed yuezhuangshi closed 2 years ago

yuezhuangshi commented 2 years ago

Follow the existing specifications and add python3.7 jenkins k8s agent image

fix #27

yuezhuangshi commented 2 years ago

Thanks for your contribution. We build this project in the GitHub actions. So, would you mind adding the build script of your PR into the GitHub actions?

By the way, I'm not familiar with Python programming. It would be great if you can provide a sample Python project. Then I can test this PR with it.

I have already added the build script, waiting for Github actions to build image. Currently, I will build the image locally, and then use the project on github for testing

yuezhuangshi commented 2 years ago

@LinuxSuRen I have tested this image locally, sample project is thefuck, sample workflow ref here and the jenkinsfile I have been used are as follow:

pipeline {
    agent {
        label 'python37'
    }

    stages {
        stage('Checkout') {
            steps {
                git branch: 'master', credentialsId: 'github', url: 'git@github.com:nvbn/thefuck.git'
            }
        }
        stage('Install dependencies') {
            steps {
                container('python') {
                    sh '''
                      pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -Ur requirements.txt coveralls
                      python setup.py develop
                    '''
                }
            }
        }
        stage('Run tests') {
            steps {
                container('python') {
                    sh 'coverage run --source=thefuck,tests -m pytest -v --capture=sys tests'
                }
            }
        }
    }
}
ks-ci-bot commented 2 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: LinuxSuRen, yuezhuangshi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubesphere/devops-agent/blob/master/OWNERS)~~ [LinuxSuRen] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
LinuxSuRen commented 2 years ago

/cc @kubesphere/sig-devops

JohnNiang commented 2 years ago

/lgtm

JohnNiang commented 2 years ago

Hi @yuezhuangshi , thanks for your contriubution.

I think we are missing docker image declaration in README.md. Can you help us add it in another PR?

yuezhuangshi commented 2 years ago

Hi @yuezhuangshi , thanks for your contriubution.

I think we are missing docker image declaration in README.md. Can you help us add it in another PR?

Sure