diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile new file mode 100644 index 0000000..8843eba --- /dev/null +++ b/.ci/Jenkinsfile @@ -0,0 +1,87 @@ +#!/usr/bin/env groovy + +@Library('apm@current') _ + +pipeline { + agent { label 'linux && immutable' } + environment { + REPO = 'ecs-logging-python' + BASE_DIR = "src/go.elastic.co/apm/${env.REPO}" + NOTIFY_TO = credentials('notify-to') + } + options { + timeout(time: 1, unit: 'HOURS') + buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '20', daysToKeepStr: '30')) + timestamps() + ansiColor('xterm') + disableResume() + durabilityHint('PERFORMANCE_OPTIMIZED') + rateLimitBuilds(throttle: [count: 60, durationName: 'hour', userBoost: true]) + quietPeriod(10) + } + triggers { + issueCommentTrigger('(?i).*jenkins\\W+run\\W+(?:the\\W+)?tests(?:\\W+please)?.*') + } + stages { + stage('Checkout') { + options { skipDefaultCheckout() } + steps { + pipelineManager([ cancelPreviousRunningBuilds: [ when: 'PR' ] ]) + deleteDir() + gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: true) + stash allowEmpty: true, name: 'source', useDefaultExcludes: false + } + } + stage('Sanity checks') { + options { skipDefaultCheckout() } + environment { + HOME = "${env.WORKSPACE}" + PATH = "${env.HOME}/bin:${env.PATH}" + } + steps { + deleteDir() + unstash 'source' + dir("${BASE_DIR}"){ + preCommit(commit: "${GIT_BASE_COMMIT}", junit: true) + } + } + } + stage('Test') { + matrix { + agent { label 'linux && immutable' } + axes { + axis { + name 'VERSION' + values '2.7', '3.5', '3.6', '3.7', '3.8' + } + } + stages { + stage('Test') { + options { skipDefaultCheckout() } + steps { + withGithubNotify(context: "Test ${VERSION}") { + deleteDir() + unstash 'source' + dir("${BASE_DIR}"){ + sh(".ci/scripts/test.sh ${VERSION}") + } + } + } + post { + always { + dir("${BASE_DIR}"){ + junit(allowEmptyResults: true, keepLongStdio: true, testResults: '**/junit*.xml') + } + } + } + } + } + } + } + } + post { + cleanup { + notifyBuildResult() + } + } +} diff --git a/.ci/jobs/defaults.yml b/.ci/jobs/defaults.yml new file mode 100644 index 0000000..97dba5c --- /dev/null +++ b/.ci/jobs/defaults.yml @@ -0,0 +1,59 @@ +--- + +##### GLOBAL METADATA + +- meta: + cluster: apm-ci + +##### JOB DEFAULTS + +- job: + view: APM-CI + project-type: multibranch + logrotate: + daysToKeep: 30 + numToKeep: 100 + number-to-keep: '5' + days-to-keep: '1' + concurrent: true + node: linux + script-path: .ci/Jenkinsfile + scm: + - github: + branch-discovery: no-pr + discover-pr-forks-strategy: merge-current + discover-pr-forks-trust: permission + discover-pr-origin: merge-current + discover-tags: true + repo: ecs-logging-python + repo-owner: elastic + credentials-id: 2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken + ssh-checkout: + credentials: f6c7695a-671e-4f4f-a331-acdce44ff9ba + build-strategies: + - tags: + ignore-tags-older-than: -1 + ignore-tags-newer-than: -1 + - regular-branches: true + - change-request: + ignore-target-only-changes: false + clean: + after: true + before: true + prune: true + shallow-clone: true + depth: 3 + do-not-fetch-tags: true + submodule: + disable: false + recursive: true + parent-credentials: true + timeout: 100 + timeout: '15' + use-author: true + wipe-workspace: 'True' + periodic-folder-trigger: 1w + prune-dead-branches: true + publishers: + - email: + recipients: infra-root+build@elastic.co diff --git a/.ci/jobs/ecs-logging-python-mbp.yml b/.ci/jobs/ecs-logging-python-mbp.yml new file mode 100644 index 0000000..7165351 --- /dev/null +++ b/.ci/jobs/ecs-logging-python-mbp.yml @@ -0,0 +1,5 @@ +--- +- job: + name: apm-agent-python/ecs-logging-python-mbp + display-name: ecs-logging-python + description: Logging formatters for the Elastic Common Schema (ECS) in Python diff --git a/.ci/scripts/lint.sh b/.ci/scripts/lint.sh new file mode 100755 index 0000000..df6a91e --- /dev/null +++ b/.ci/scripts/lint.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -e + +echo 'TBD' \ No newline at end of file diff --git a/.ci/scripts/test.sh b/.ci/scripts/test.sh new file mode 100755 index 0000000..df6a91e --- /dev/null +++ b/.ci/scripts/test.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -e + +echo 'TBD' \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..18fb3c5 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,14 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.2.3 + hooks: + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-merge-conflict + +- repo: git@github.com:elastic/apm-pipeline-library + rev: current + hooks: + - id: check-bash-syntax + - id: check-jenkins-pipelines + - id: check-jjbb