Skip to content
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

chore(deployment): Initial migration to jenkins #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions .circleci/config.yml

This file was deleted.

82 changes: 82 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
library 'magic-butler-catalogue'

def PROJECT_NAME = 'logdna-cli'
def CURRENT_BRANCH = [env.CHANGE_BRANCH, env.BRANCH_NAME]?.find{branch -> branch != null}
def DEFAULT_BRANCH = 'master'
def TRIGGER_PATTERN = ".*@logdnabot.*"
def DRY_RUN = CURRENT_BRANCH != DEFAULT_BRANCH
def CHANGE_ID = env.CHANGE_ID == null ? '' : env.CHANGE_ID

pipeline {
agent none

options {
timestamps()
ansiColor 'xterm'
}

triggers {
issueCommentTrigger(TRIGGER_PATTERN)
}

environment {
GITHUB_TOKEN = credentials('github-api-token')
NPM_TOKEN = credentials('npm-publish-token')
NPM_CONFIG_CACHE = '.npm'
NPM_CONFIG_USERCONFIG = '.npmrc'
SPAWN_WRAP_SHIM_ROOT = '.npm'
}

stages {

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

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

environment {
GIT_BRANCH = "${CURRENT_BRANCH}"
BRANCH_NAME = "${CURRENT_BRANCH}"
CHANGE_ID = ""
}

steps {
sh 'npm install'
sh 'npm run release:dry'
}
}

stage ('Release') {
agent {
docker {
image "us.gcr.io/logdna-k8s/node:14-ci"
customWorkspace "${PROJECT_NAME}-${BUILD_NUMBER}"
}
}

when {
beforeAgent true
branch DEFAULT_BRANCH
not {
changelog '\\[skip ci\\]'
}
}

steps {
sh "mkdir -p ${NPM_CONFIG_CACHE}"
sh 'npm install'
sh 'npm run release'
}
}
}
}
32 changes: 3 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,10 @@ The LogDNA CLI allows you to sign up for a new account and tail your logs right

## Getting Started

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

Download the [LogDNA CLI installer for Mac](http://repo.logdna.com/mac/logdna-cli.pkg).

Alternatively install via [brew cask](https://caskroom.github.io/):
```
brew cask update
brew cask install logdna-cli
```

### Windows

To install on Windows, using [chocolatey](https://chocolatey.org):

```
choco install logdna
```

### Linux

For Ubuntu/Debian:

```bash
sudo wget -qO /tmp/logdna-cli.deb http://repo.logdna.com/linux/logdna-cli.deb && sudo dpkg -i /tmp/logdna-cli.deb
```

For RHEL/CentOS:

```bash
sudo wget -qO /tmp/logdna-cli.rpm http://repo.logdna.com/linux/logdna-cli.rpm && sudo rpm -ivh /tmp/logdna-cli.rpm
```shell
npm install -g logdna-cli@latest
```

### From Source
Expand Down
14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@
"description": "LogDNA CLI",
"main": "index.js",
"scripts": {
"lint": "node_modules/.bin/grunt lint"
"lint": "node_modules/.bin/grunt lint",
"release": "semantic-release",
"release:dry": "semantic-release --dry-run --no-ci --branches=${BRANCH_NAME:-master}"
},
"release": {
"branches": [
"master"
],
"extends": "semantic-release-config-logdna"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -35,6 +43,8 @@
"grunt-eslint": "^22.0.0",
"grunt-exec": "^3.0.0",
"grunt-line-remover": "0.0.2",
"load-grunt-tasks": "^5.0.0"
"load-grunt-tasks": "^5.0.0",
"semantic-release": "^17.4.7",
"semantic-release-config-logdna": "^1.3.0"
}
}