Skip to content

Commit 5fea4d1

Browse files
committed
chore(deployment)!: Initial migration to jenkins
This does a simple migration to jenkins with a basic npm publish BREAKING CHANGE: remove native OS packaging
1 parent cf8330d commit 5fea4d1

4 files changed

Lines changed: 97 additions & 50 deletions

File tree

.circleci/config.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

Jenkinsfile

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
library 'magic-butler-catalogue'
2+
3+
def PROJECT_NAME = 'logdna-cli'
4+
def CURRENT_BRANCH = [env.CHANGE_BRANCH, env.BRANCH_NAME]?.find{branch -> branch != null}
5+
def DEFAULT_BRANCH = 'master'
6+
def TRIGGER_PATTERN = ".*@logdnabot.*"
7+
def DRY_RUN = CURRENT_BRANCH != DEFAULT_BRANCH
8+
def CHANGE_ID = env.CHANGE_ID == null ? '' : env.CHANGE_ID
9+
10+
pipeline {
11+
agent none
12+
13+
options {
14+
timestamps()
15+
ansiColor 'xterm'
16+
}
17+
18+
triggers {
19+
issueCommentTrigger(TRIGGER_PATTERN)
20+
}
21+
22+
environment {
23+
GITHUB_TOKEN = credentials('github-api-token')
24+
NPM_TOKEN = credentials('npm-publish-token')
25+
NPM_CONFIG_CACHE = '.npm'
26+
NPM_CONFIG_USERCONFIG = '.npmrc'
27+
SPAWN_WRAP_SHIM_ROOT = '.npm'
28+
}
29+
30+
stages {
31+
32+
stage('Test Release') {
33+
when {
34+
beforeAgent true
35+
not {
36+
branch DEFAULT_BRANCH
37+
}
38+
}
39+
40+
agent {
41+
docker {
42+
image "us.gcr.io/logdna-k8s/node:14-ci"
43+
customWorkspace "${PROJECT_NAME}-${BUILD_NUMBER}"
44+
}
45+
}
46+
47+
environment {
48+
GIT_BRANCH = "${CURRENT_BRANCH}"
49+
BRANCH_NAME = "${CURRENT_BRANCH}"
50+
CHANGE_ID = ""
51+
}
52+
53+
steps {
54+
sh 'npm install'
55+
sh 'npm run release:dry'
56+
}
57+
}
58+
59+
stage ('Release') {
60+
agent {
61+
docker {
62+
image "us.gcr.io/logdna-k8s/node:14-ci"
63+
customWorkspace "${PROJECT_NAME}-${BUILD_NUMBER}"
64+
}
65+
}
66+
67+
when {
68+
beforeAgent true
69+
branch DEFAULT_BRANCH
70+
not {
71+
changelog '\\[skip ci\\]'
72+
}
73+
}
74+
75+
steps {
76+
sh "mkdir -p ${NPM_CONFIG_CACHE}"
77+
sh 'npm install'
78+
sh 'npm run release'
79+
}
80+
}
81+
}
82+
}

README.md

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,10 @@ The LogDNA CLI allows you to sign up for a new account and tail your logs right
1010

1111
## Getting Started
1212

13-
### macOS
13+
Install [Node.JS](https://nodejs.org/en/)
1414

15-
Download the [LogDNA CLI installer for Mac](http://repo.logdna.com/mac/logdna-cli.pkg).
16-
17-
Alternatively install via [brew cask](https://caskroom.github.io/):
18-
```
19-
brew cask update
20-
brew cask install logdna-cli
21-
```
22-
23-
### Windows
24-
25-
To install on Windows, using [chocolatey](https://chocolatey.org):
26-
27-
```
28-
choco install logdna
29-
```
30-
31-
### Linux
32-
33-
For Ubuntu/Debian:
34-
35-
```bash
36-
sudo wget -qO /tmp/logdna-cli.deb http://repo.logdna.com/linux/logdna-cli.deb && sudo dpkg -i /tmp/logdna-cli.deb
37-
```
38-
39-
For RHEL/CentOS:
40-
41-
```bash
42-
sudo wget -qO /tmp/logdna-cli.rpm http://repo.logdna.com/linux/logdna-cli.rpm && sudo rpm -ivh /tmp/logdna-cli.rpm
15+
```shell
16+
npm install -g logdna-cli@latest
4317
```
4418

4519
### From Source

package.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44
"description": "LogDNA CLI",
55
"main": "index.js",
66
"scripts": {
7-
"lint": "node_modules/.bin/grunt lint"
7+
"lint": "node_modules/.bin/grunt lint",
8+
"release": "semantic-release",
9+
"release:dry": "semantic-release --dry-run --no-ci --branches=${BRANCH_NAME:-master}"
10+
},
11+
"release": {
12+
"branches": [
13+
"master"
14+
],
15+
"extends": "semantic-release-config-logdna"
816
},
917
"repository": {
1018
"type": "git",
@@ -35,6 +43,8 @@
3543
"grunt-eslint": "^22.0.0",
3644
"grunt-exec": "^3.0.0",
3745
"grunt-line-remover": "0.0.2",
38-
"load-grunt-tasks": "^5.0.0"
46+
"load-grunt-tasks": "^5.0.0",
47+
"semantic-release": "^17.4.7",
48+
"semantic-release-config-logdna": "^1.3.0"
3949
}
4050
}

0 commit comments

Comments
 (0)