freeleaps-ops/first-class-pipeline/tests/Jenkinsfile

119 lines
6.1 KiB
Plaintext
Raw Normal View History

library 'first-class-pipeline'
executeFreeleapsPipeline {
// serviceName is the name of the service, which is used to identify the service
serviceName = 'magicleaps'
// serviceSlug used to identify the service environment
environmentSlug = 'alpha'
// serviceGitBranch used to specify the git repo branch of the service codes
serviceGitBranch = 'master'
// serviceGitRepo used to specify the git repo of the service codes
serviceGitRepo = "https://freeleaps@dev.azure.com/freeleaps/magicleaps/_git/magicleaps"
// serviceGitRepoType used to specify the git repo type of the service codes
// monorepo: all services codes are in the same repo and using sub-folders to separate them
// separated: each service has its own repo
serviceGitRepoType = 'monorepo' // monorepo, separated
// executeMode used to specify the pipeline execution mode
// on-demand: the pipeline will be triggered with code changes, only changed components will be executed
// fully: the pipeline will be triggered without code changes, all components will be executed
executeMode = 'fully' // on-demand, fully
// commitMessageLintEnabled used to specify whether to enable commit message lint
commitMessageLintEnabled = false
// components used to specify the service components
components = [
[
// name is the name of the component, which is used to identify the component
name: 'frontend',
// root is the root folder of the component codes
root: 'frontend',
// language is the programming language of the component codes
language: 'javascript',
// dependenciesManager used to specify which dependencies manager to use
dependenciesManager: 'npm',
// npmPackageJsonFile used to specify the npm package.json file path when dependenciesManager set to npm
npmPackageJsonFile: 'package.json',
// buildCacheEnabled used to specify whether to enable build dependencies cache
buildCacheEnabled: true,
// buildCommand used to specify the build command of the component
buildCommand: 'npm run build',
// lintEnabled used to specify whether to enable code lint
lintEnabled: true,
// linter used to specify the code linter
linter: 'eslint',
// linterConfig used to specify the code linter configuration file path, if not set, will use the default configuration
// linterConfig: '.eslintrc.js',
// sastEnabled used to specify whether to enable SAST scan
sastEnabled: false,
// sastScanner used to specify the SAST scanner
// FIXME: JS has no production-ready SAST scanner yet
// sastScanner: '',
// imageRegistry used to specify the which registry to push the image
imageRegistry: 'docker.io',
// imageRepository used to specify the image repository
imageRepository: 'sunzhenyucn',
// imageName used to specify the image name
imageName: 'magicleaps-frontend',
// imageBuilder used to specify the image builder
// dind: using docker-in-docker to build the image
// kaniko: using Kaniko to build the image
imageBuilder: 'dind',
// dockerfilePath used to specify the Dockerfile path
dockerfilePath: 'Dockerfile',
// imageBuildRoot used to specify the image build context root
imageBuildRoot: '.',
// imageReleaseArchitectures used to specify the released image architectures
imageReleaseArchitectures: ['amd64', 'arm64'],
// registryCredentialName used to specify the registry credential that stored in Freeleaps Kubernetes Cluster
registryCredentialName: 'first-class-pipeline-dev-secret',
// semanticReleaseEnabled used to specify whether to enable semantic release
semanticReleaseEnabled: true,
// semanticReleaseBranch used to specify the which branch to publish release notes
semanticReleaseBranch: 'master'
],
[
// name is the name of the component, which is used to identify the component
name: 'backend',
// root is the root folder of the component codes
root: 'backend',
// language is the programming language of the component codes
language: 'python',
// dependenciesManager used to specify which dependencies manager to use
dependenciesManager: 'pip',
// buildCacheEnabled used to specify whether to enable build dependencies cache
buildCacheEnabled: true,
// buildCommand used to specify the build command of the component
lintEnabled: true,
// linter used to specify the code linter
linter: 'pylint',
// linterConfig used to specify the code linter configuration file path, if not set, will use the default configuration
// linterConfig: '.pylintrc',
// sastEnabled used to specify whether to enable SAST scan
sastEnabled: true,
// sastScanner used to specify the SAST scanner
// FIXME: Python has no production-ready SAST scanner yet
sastScanner: 'bandit',
// imageRegistry used to specify the which registry to push the image
imageRegistry: 'docker.io',
// imageRepository used to specify the image repository
imageRepository: 'sunzhenyucn',
// imageName used to specify the image name
imageName: 'magicleaps-backend',
// imageBuilder used to specify the image builder
// dind: using docker-in-docker to build the image
// kaniko: using Kaniko to build the image
imageBuilder: 'dind',
// dockerfilePath used to specify the Dockerfile path
dockerfilePath: 'Dockerfile',
// imageBuildRoot used to specify the image build context root
imageBuildRoot: '.',
// imageReleaseArchitectures used to specify the released image architectures
imageReleaseArchitectures: ['amd64', 'arm64'],
// registryCredentialName used to specify the registry credential that stored in Freeleaps Kubernetes Cluster
registryCredentialName: 'first-class-pipeline-dev-secret',
// semanticReleaseEnabled used to specify whether to enable semantic release
semanticReleaseEnabled: true,
// semanticReleaseBranch used to specify the which branch to publish release notes
semanticReleaseBranch: 'master'
]
]
}