-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci(jenkins): enable pipeline #8
Changes from 4 commits
2e6ad6b
fc7f315
ef4b5a8
fb3a1e4
33b669d
b9b6647
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env groovy | ||
|
||
@Library('apm@current') _ | ||
|
||
pipeline { | ||
agent { label 'linux && immutable' } | ||
environment { | ||
REPO = 'apm-agent-php' | ||
BASE_DIR = "src/go.elastic.co/apm/${env.REPO}" | ||
NOTIFY_TO = credentials('notify-to') | ||
JOB_GCS_BUCKET = credentials('gcs-bucket') | ||
} | ||
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 { | ||
deleteDir() | ||
gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: true) | ||
stash allowEmpty: true, name: 'source', useDefaultExcludes: false | ||
} | ||
} | ||
stage('Build') { | ||
options { skipDefaultCheckout() } | ||
steps { | ||
withGithubNotify(context: 'Build') { | ||
deleteDir() | ||
unstash 'source' | ||
dir("${BASE_DIR}"){ | ||
sh script: 'docker build --tag apm-agent-php .', label: 'prepare docker image' | ||
sh script: 'docker run --rm -t -v $(pwd):/app apm-agent-php', label: 'run docker container' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
post { | ||
cleanup { | ||
notifyBuildResult() | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
- job: | ||
name: apm-agent-php/apm-agent-php-mbp | ||
display-name: APM Agent PHP | ||
description: APM Agent PHP |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
- job: | ||
name: apm-agent-php | ||
project-type: folder |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
|
||
##### GLOBAL METADATA | ||
|
||
- meta: | ||
cluster: apm-ci | ||
|
||
##### JOB DEFAULTS | ||
|
||
- job: | ||
view: APM-CI | ||
project-type: multibranch | ||
logrotate: | ||
numToKeep: 100 | ||
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 | ||
notification-context: 'apm-ci' | ||
repo: apm-agent-php | ||
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: 1d | ||
prune-dead-branches: true | ||
publishers: | ||
- email: | ||
recipients: infra-root+build@elastic.co |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.ci | ||
.dockerignore | ||
.git | ||
.gitignore | ||
docker | ||
docs | ||
Dockerfile | ||
README.md |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM wordpress:php7.3-fpm-alpine | ||
|
||
RUN apk --no-cache add build-base autoconf curl-dev | ||
|
||
WORKDIR /app/src/ext | ||
|
||
CMD phpize \ | ||
&& ./configure --enable-elasticapm \ | ||
&& make clean \ | ||
&& make \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was not sure whether either There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've decided to change the approach:
The reason is to help to categorize those commands in stages in the pipeline and visualise them easily in the CI.
v1v marked this conversation as resolved.
Show resolved
Hide resolved
|
||
&& make install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to copy the extension to
/app/src/ext
first in order compile "it" on L:7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not required since this particular docker image is only for the environmental requirements.
The docker container should mount the volume and therefore the
CMD
directive will run those commands using the mounted volume.