| #!groovy |
| // -*- mode: groovy -*- |
| |
| // Licensed to the Apache Software Foundation (ASF) under one |
| // or more contributor license agreements. See the NOTICE file |
| // distributed with this work for additional information |
| // regarding copyright ownership. The ASF licenses this file |
| // to you under the Apache License, Version 2.0 (the |
| // "License"); you may not use this file except in compliance |
| // with the License. You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, |
| // software distributed under the License is distributed on an |
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| // KIND, either express or implied. See the License for the |
| // specific language governing permissions and limitations |
| // under the License. |
| |
| // Jenkins pipeline |
| // See documents at https://jenkins.io/doc/book/pipeline/jenkinsfile/ |
| |
| // Docker env used for testing |
| // Different image may have different version tag |
| // because some of them are more stable than anoter. |
| // |
| // Docker images are maintained by PMC, cached in dockerhub |
| // and remains relatively stable over the time. |
| // Flow for upgrading docker env(need commiter) |
| // |
| // - Send PR to upgrade build script in the repo |
| // - Build the new docker image |
| // - Tag the docker image with a new version and push to a binary cache. |
| // - Update the version in the Jenkinsfile, send a PR |
| // - Fix any issues wrt to the new image version in the PR |
| // - Merge the PR and now we are in new version |
| // - Tag the new version as the lates |
| // - Periodically cleanup the old versions on local workers |
| // |
| |
| // ============================= IMPORTANT NOTE ============================= |
| // This file is generated by 'jenkins/generate.py'. Do not edit this file directly! |
| // Make edits to 'jenkins/Jenkinsfile.j2' and regenerate this with |
| // 'python3 jenkins/generate.py' |
| // Note: This timestamp is here to ensure that updates to the Jenkinsfile are |
| // always rebased on main before merging: |
| // Generated at {{ generated_time }} |
| |
| import org.jenkinsci.plugins.pipeline.modeldefinition.Utils |
| {% import 'jenkins/macros.j2' as m with context -%} |
| |
| // NOTE: these lines are scanned by docker/dev_common.sh. Please update the regex as needed. --> |
| ci_lint = 'tlcpack/ci-lint:20220513-055910-fa834f67e' |
| ci_gpu = 'tlcpack/ci-gpu:20220619-055908-9bba7580b' |
| ci_cpu = 'tlcpack/ci-cpu:20220519-055908-ddfa1da69' |
| ci_wasm = 'tlcpack/ci-wasm:20220513-055910-fa834f67e' |
| ci_i386 = 'tlcpack/ci-i386:20220513-055910-fa834f67e' |
| ci_qemu = 'tlcpack/ci-qemu:20220517-094028-de21c8f2e' |
| ci_arm = 'tlcpack/ci-arm:20220513-055910-fa834f67e' |
| ci_hexagon = 'tlcpack/ci-hexagon:20220603-203325-cee74c9f8' |
| // <--- End of regex-scanned config. |
| |
| // Parameters to allow overriding (in Jenkins UI), the images |
| // to be used by a given build. When provided, they take precedence |
| // over default values above. |
| properties([ |
| parameters([ |
| {% for image in images %} |
| string(name: '{{ image.name }}_param', defaultValue: ''), |
| {% endfor %} |
| ]) |
| ]) |
| |
| // Global variable assigned during Sanity Check that holds the sha1 which should be |
| // merged into the PR in all branches. |
| upstream_revision = null |
| |
| // command to start a docker container |
| docker_run = 'docker/bash.sh --env CI --env TVM_SHARD_INDEX --env TVM_NUM_SHARDS --env RUN_DISPLAY_URL --env PLATFORM' |
| docker_build = 'docker/build.sh' |
| // timeout in minutes |
| max_time = 180 |
| rebuild_docker_images = false |
| |
| // skips builds from branch indexing; sourced from https://www.jvt.me/posts/2020/02/23/jenkins-multibranch-skip-branch-index/ |
| // execute this before anything else, including requesting any time on an agent |
| if (currentBuild.getBuildCauses().toString().contains('BranchIndexingCause')) { |
| print "INFO: Build skipped due to trigger being Branch Indexing" |
| currentBuild.result = 'ABORTED' // optional, gives a better hint to the user that it's been skipped, rather than the default which shows it's successful |
| return |
| } |
| |
| // Filenames for stashing between build and test steps |
| {% set tvm_runtime = ['build/libtvm_runtime.so', 'build/config.cmake'] %} |
| {% set tvm_lib = ['build/libtvm.so'] + tvm_runtime %} |
| {% set tvm_multilib = ['build/libtvm.so', 'build/libvta_fsim.so'] + tvm_runtime %} |
| {% set tvm_multilib_tsim = ['build/libvta_tsim.so'] + tvm_multilib %} |
| {% set microtvm_template_projects = ['build/microtvm_template_projects',] %} |
| {% set hexagon_api = ['build/hexagon_api_output',] %} |
| s3_prefix = "tvm-jenkins-artifacts-prod/tvm/${env.BRANCH_NAME}/${env.BUILD_NUMBER}" |
| |
| {% set aws_default_region = "us-west-2" %} |
| {% set aws_ecr_url = "dkr.ecr." + aws_default_region + ".amazonaws.com" %} |
| |
| // General note: Jenkins has limits on the size of a method (or top level code) |
| // that are pretty strict, so most usage of groovy methods in these templates |
| // are purely to satisfy the JVM |
| {% include "jenkins/Prepare.groovy.j2" %} |
| {% include "jenkins/DockerBuild.groovy.j2" %} |
| {% include "jenkins/Lint.groovy.j2" %} |
| {% include "jenkins/Build.groovy.j2" %} |
| {% include "jenkins/Test.groovy.j2" %} |
| {% include "jenkins/Deploy.groovy.j2" %} |
| |
| |
| cancel_previous_build() |
| |
| prepare() |
| |
| if (rebuild_docker_images) { |
| build_docker_images() |
| } |
| |
| lint() |
| |
| build() |
| |
| test() |
| |
| deploy() |