-
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
Merged
+187
−1
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2e6ad6b
ci(jenkins): enable jjbb
v1v fc7f315
ci(jenkins): enable CI Pipeline
v1v ef4b5a8
Dockerise the build requirements to be used within the CI Pipeline
v1v fb3a1e4
fix
v1v 33b669d
Enable test goal and split pipeline in build,test and install stages.…
v1v b9b6647
avoid deleteDir as the workspace is required to be used between stage…
v1v File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/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 build' | ||
} | ||
} | ||
} | ||
} | ||
stage('Test') { | ||
options { skipDefaultCheckout() } | ||
steps { | ||
withGithubNotify(context: 'Test', tab: 'tests') { | ||
deleteDir() | ||
unstash 'source' | ||
dir("${BASE_DIR}"){ | ||
sh script: 'docker run --rm -t -v $(pwd):/app apm-agent-php make test', label: 'run tests' | ||
} | ||
} | ||
} | ||
post { | ||
always { | ||
junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/junit.xml") | ||
} | ||
} | ||
} | ||
stage('Install') { | ||
options { skipDefaultCheckout() } | ||
steps { | ||
withGithubNotify(context: 'Install') { | ||
deleteDir() | ||
unstash 'source' | ||
dir("${BASE_DIR}"){ | ||
sh script: 'docker run --rm -t -v $(pwd):/app apm-agent-php make install', label: 'run install' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
post { | ||
cleanup { | ||
notifyBuildResult() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
- job: | ||
name: apm-agent-php | ||
project-type: folder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.ci | ||
.dockerignore | ||
.git | ||
.gitignore | ||
docker | ||
docs | ||
Dockerfile | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
docker/wordpress/ephemeral/ | ||
docker/wordpress/data/ext | ||
.DS_Store | ||
|
||
junit.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM wordpress:php7.3-fpm-alpine | ||
|
||
RUN apk --no-cache add build-base autoconf curl-dev | ||
|
||
WORKDIR /app/src/ext | ||
|
||
ENV REPORT_EXIT_STATUS=1 | ||
ENV TEST_PHP_DETAILED=1 | ||
ENV NO_INTERACTION=1 | ||
ENV TEST_PHP_JUNIT=/app/junit.xml | ||
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. This env variable and the above ones are required when running the make test to help with:
|
||
|
||
CMD phpize \ | ||
&& ./configure --enable-elasticapm \ | ||
&& make clean \ | ||
&& make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.