Skip to content

Commit

Permalink
Support daily snapshots
Browse files Browse the repository at this point in the history
Signed-off-by: Adrien Mannocci <[email protected]>
  • Loading branch information
amannocci committed Dec 6, 2022
1 parent 6883130 commit 7a3a397
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
31 changes: 31 additions & 0 deletions .ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,37 @@ pipeline {
}
}
}

/**
Daily snapshots.
*/
stage('Daily snapshots') {
options { skipDefaultCheckout() }
environment {
DOCKER_REGISTRY = 'docker.elastic.co'
DOCKER_REGISTRY_SECRET = 'secret/observability-team/ci/docker-registry/prod'
GCS_ACCOUNT_SECRET = 'secret/observability-team/ci/snapshoty'
}
// when { branch 'main' }
steps {
withGithubNotify(context: 'Publish snapshot packages') {
deleteDir()
unstash name: 'source'
withNodeJSEnv(version: readFile(file: "${BASE_DIR}/.nvmrc")?.trim()) {
dir(env.BASE_DIR) {
sh(label: 'generate tarball', script: 'npm run package:tarball')
snapshoty(
bucket: 'obtl-artifacts',
gcsAccountSecret: env.GCS_ACCOUNT_SECRET,
dockerRegistry: env.DOCKER_REGISTRY,
dockerSecret: env.DOCKER_REGISTRY_SECRET
)
}
}
}
}
}

stage('Release') {
options { skipDefaultCheckout() }
when {
Expand Down
36 changes: 36 additions & 0 deletions .ci/snapshoty.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---

# Version of configuration to use
version: '1.0'

# You can define a Google Cloud Account to use
account:
# Project id of the service account
project: '${GCS_PROJECT}'
# Private key id of the service account
private_key_id: '${GCS_PRIVATE_KEY_ID}'
# Private key of the service account
private_key: '${GCS_PRIVATE_KEY}'
# Email of the service account
client_email: '${GCS_CLIENT_EMAIL}'
# URI token
token_uri: 'https://oauth2.googleapis.com/token'

# List of artifacts
artifacts:
# Path to use for artifacts discovery
- path: './build/dist'
# Files pattern to match
files_pattern: 'elastic-apm-node-(?P<app_version>\d+\.\d+\.\d+)\.tgz'
# File layout on GCS bucket
output_pattern: '{project}/{jenkins_branch_name}/elastic-apm-node-{app_version}-{jenkins_git_commit_short}.tgz'
# List of metadata processors to use.
metadata:
# Define static custom metadata
- name: 'custom'
data:
project: 'apm-agent-nodejs'
# Add git metadata
- name: 'git'
# Add jenkins metadata
- name: 'jenkins'
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"docker:start": "docker-compose -f ./test/docker-compose.yml up -d",
"docker:stop": "docker-compose -f ./test/docker-compose.yml down",
"docker:clean": "./test/script/docker/cleanup.sh",
"docker:dev": "docker-compose -f ./dev-utils/docker-compose.yml run --workdir=/agent nodejs-agent"
"docker:dev": "docker-compose -f ./dev-utils/docker-compose.yml run --workdir=/agent nodejs-agent",
"package:tarball": "mkdir -p ./build/dist && npm pack --pack-destination ./build/dist"
},
"directories": {
"test": "test"
Expand Down

0 comments on commit 7a3a397

Please sign in to comment.