Skip to content

Commit

Permalink
ci!: replace CircleCI with Jenkins
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Environment variables have been removed/renamed

This removes CircleCI and goes with Jenkins and sets up for the
2.0.0 release

Ref: #4
  • Loading branch information
Samir Musali authored and smusali committed Apr 29, 2021
1 parent e2a9398 commit 9370e76
Show file tree
Hide file tree
Showing 14 changed files with 5,894 additions and 1,257 deletions.
90 changes: 0 additions & 90 deletions .circleci/config.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# No Temporary File
*.swp
.DS_Store
pkg

# No NPM Modules
node_modules

# No ZIP Files
*.zip
**/*.zip

# No Testing Materials
data
Expand Down
133 changes: 133 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
library 'magic-butler-catalogue'

def PROJECT_NAME = "logdna-s3"
def REPO = "logdna/${PROJECT_NAME}"
def TRIGGER_PATTERN = ".*@logdnabot.*"
def CURRENT_BRANCH = [env.CHANGE_BRANCH, env.BRANCH_NAME]?.find{branch -> branch != null}
def DEFAULT_BRANCH = 'master'

pipeline {
agent none

options {
timestamps()
ansiColor 'xterm'
}

triggers {
issueCommentTrigger(TRIGGER_PATTERN)
}

stages {
stage('Validate PR Source') {
when {
expression { env.CHANGE_FORK }
not {
triggeredBy 'issueCommentCause'
}
}
steps {
error("A maintainer needs to approve this PR for CI by commenting")
}
}

stage('Test Suite') {
matrix {
axes {
axis {
name 'NODE_VERSION'
values '12', '14', '16'
}
}

agent {
docker {
image "us.gcr.io/logdna-k8s/node:${NODE_VERSION}-ci"
}
}

environment {
GITHUB_TOKEN = credentials('github-api-token')
}

stages {
stage('Test') {
steps {
sh 'mkdir -p coverage'
sh 'npm ci'
sh 'npm run test:ci'
}

post {
always {
junit 'coverage/test.xml'

publishHTML target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'coverage/lcov-report',
reportFiles: 'index.html',
reportName: "coverage-node-v${NODE_VERSION}"
]
}
}
}
}
}
}

stage('Test Release') {
when {
beforeAgent true
not {
branch DEFAULT_BRANCH
}
}

agent {
docker {
image "us.gcr.io/logdna-k8s/node:12-ci"
customWorkspace "${PROJECT_NAME}-${BUILD_NUMBER}"
}
}

environment {
GITHUB_TOKEN = credentials('github-api-token')
GIT_BRANCH = "${CURRENT_BRANCH}"
BRANCH_NAME = "${CURRENT_BRANCH}"
CHANGE_ID = ""
}

steps {
sh 'npm run package'
sh 'npm ci'
sh "npm run release:dry"
}
}

stage('Release') {
when {
beforeAgent true
branch DEFAULT_BRANCH
}

agent {
docker {
image "us.gcr.io/logdna-k8s/node:12-ci"
customWorkspace "${PROJECT_NAME}-${BUILD_NUMBER}"
}
}

environment {
GITHUB_TOKEN = credentials('github-api-token')
}

steps {
sh 'npm run package'
sh 'npm ci'
sh 'npm run release'
}
}
}
}
Loading

0 comments on commit 9370e76

Please sign in to comment.