coding构建计划

coding构建计划。t2video,pyging,chamm。

t2video

本次使用2021-05-30

  • 更改为coding的自己的docker python3.7
  • 可以直接安装ffmpeg
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    pipeline {
    agent {
    docker {
    reuseNode 'true'
    registryUrl 'https://coding-public-docker.pkg.coding.net'
    image 'public/docker/python:3.7'
    }

    }
    stages {
    stage('阶段 3-1') {
    steps {
    sh 'apt-get update'
    sh 'apt-get install libc6-dev -y --force-yes'
    sh 'apt-get install ffmpeg -y --force-yes'
    sh 'ffmpeg -version'
    }
    }
    stage('检出') {
    steps {
    checkout([$class: 'GitSCM',
    branches: [[name: GIT_BUILD_REF]],
    userRemoteConfigs: [[
    url: GIT_REPO_URL,
    credentialsId: CREDENTIALS_ID
    ]]])
    sh '''pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
    pip install pymongo[srv]'''
    }
    }
    stage('运行') {
    steps {
    sh 'python run1key.py'
    codingArtifactsGeneric(files: 'produce/*.mp4', repoName: 'mp4')
    }
    }
    }
    environment {
    CODING_DOCKER_REG_HOST = "${CCI_CURRENT_TEAM}-docker.pkg.${CCI_CURRENT_DOMAIN}"
    CODING_DOCKER_IMAGE_NAME = "${PROJECT_NAME.toLowerCase()}/${DOCKER_REPO_NAME}/${DOCKER_IMAGE_NAME}"
    }
    }

历史记录1

  • 静态jenkinsfile
  • 主要式包含对于更新源的修改,ffmpeg的安装。
  • 使用的自动创建的docker ‘python:3.5.2’
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    pipeline {
    agent {
    docker 'python:3.5.2'
    }
    stages {
    stage('并行阶段 1') {
    parallel {
    stage('部署环境ffmpeg') {
    steps {
    sh 'cat /etc/apt/sources.list'
    sh 'rm -f /etc/apt/sources.list'
    sh 'sh -c \'echo "deb [check-valid-until=no] http://mirrors.ustc.edu.cn/debian/ buster main contrib non-free" >> /etc/apt/sources.list\''
    sh 'sh -c \'echo "deb [check-valid-until=no] http://mirrors.ustc.edu.cn/debian/ buster-updates main contrib non-free" >> /etc/apt/sources.list\''
    sh 'sh -c \'echo "deb [check-valid-until=no] http://mirrors.ustc.edu.cn/debian-security buster/updates main contrib non-free" >> /etc/apt/sources.list\''
    sh 'sh -c \'echo "deb [check-valid-until=no] http://mirrors.ustc.edu.cn/debian-multimedia/ buster main non-free" >> /etc/apt/sources.list\''
    sh 'cat /etc/apt/sources.list'
    sh 'apt-get -o Acquire::Check-Valid-Until=false update'
    sh 'apt-get install deb-multimedia-keyring -y --force-yes'
    sh 'apt-get update'
    sh 'apt-get install libc6-dev -y --force-yes'
    sh 'apt-get install ffmpeg -y --force-yes'
    sh 'ffmpeg -version'
    }
    }
    stage('检出') {
    steps {
    checkout([
    $class: 'GitSCM', branches: [[name: env.GIT_BUILD_REF]],
    userRemoteConfigs: [[
    url: env.GIT_REPO_URL,
    credentialsId: env.CREDENTIALS_ID
    ]]
    ])
    sh '''pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
    pip install pymongo[srv]'''
    }
    }
    stage('配置环境') {
    steps {
    sh 'python -V'
    sh 'pip -V'
    }
    }
    }
    }
    stage('构建') {
    steps {
    echo '构建中...'
    echo '构建完成.'
    script {
    def exists = fileExists 'README.md'
    if (!exists) {
    writeFile(file: 'README.md', text: 'Helloworld')
    }
    }

    echo '完成python'
    }
    }
    stage('部署') {
    steps {
    echo '部署中...'
    echo '部署完成'
    sh 'python run1key.py'
    codingArtifactsGeneric(credentialsId: '${env.CODING_ARTIFACTS_CREDENTIALS_ID}', withBuildProps: true, files: 'produce/*.mp4', repoName: 'mp4')
    }
    }
    }
    }

pygking的集成代码

可以用2021-05-30

  • 可用,使用的docker
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    pipeline {
    agent {
    docker {
    reuseNode 'true'
    registryUrl 'https://coding-public-docker.pkg.coding.net'
    image 'public/docker/python:3.7'
    }

    }
    stages {
    stage('检出') {
    steps {
    checkout([
    $class: 'GitSCM',
    branches: [[name: GIT_BUILD_REF]],
    userRemoteConfigs: [[
    url: GIT_REPO_URL,
    credentialsId: CREDENTIALS_ID
    ]]])
    sh 'pip install -r requirements.txt'
    }
    }
    stage('阶段 2-1') {
    steps {
    sh 'python runrun.py -s'
    }
    }
    }
    }

历史记录

  • 记录中有删除等代码
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    pipeline {
    agent any
    stages {
    stage('阶段 3-1') {
    steps {
    sh '''python --version
    python -m pip -V
    sudo apt-get purge --auto-remove python3.8 -y
    sudo apt-get purge --auto-remove python3.9 -y

    update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1

    apt-get install python-pip -y
    python -m pip -V
    python --version'''
    sh '''python -m pip -V
    python -m site

    python -m site
    '''
    }
    }
    stage('并行阶段 1') {
    parallel {
    stage('部署环境ffmpeg') {
    steps {
    sh 'cat /etc/apt/sources.list'
    sh 'python --version'
    }
    }
    stage('检出') {
    steps {
    checkout([
    $class: 'GitSCM',
    branches: [[name: env.GIT_BUILD_REF]],
    userRemoteConfigs: [[
    url: env.GIT_REPO_URL,
    credentialsId: env.CREDENTIALS_ID
    ]]])
    sh '''pip install -r requirements.txt
    pip install pymongo[srv]
    pip show pytz'''
    }
    }
    stage('配置环境') {
    steps {
    sh 'python -V'
    sh 'pip -V'
    }
    }
    }
    }
    stage('部署') {
    steps {
    echo '部署完成'
    sh 'python runrun.py -s'
    }
    }
    }
    }

chanmm

  • 可用docker python3.7
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    pipeline {
    agent {
    docker {
    reuseNode 'true'
    registryUrl 'https://coding-public-docker.pkg.coding.net'
    image 'public/docker/python:3.7'
    }

    }
    stages {
    stage('检出') {
    steps {
    checkout([
    $class: 'GitSCM',
    branches: [[name: GIT_BUILD_REF]],
    userRemoteConfigs: [[
    url: GIT_REPO_URL,
    credentialsId: CREDENTIALS_ID
    ]]])
    sh 'pip install requests'
    }
    }
    stage('自定义构建过程') {
    steps {
    sh 'python mainf.py'
    }
    }
    }
    }