-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from dcos-labs/danielmschmidt/DCOS-21772-add-ci-cd
DCOS-21772: add CI/CD
- Loading branch information
Showing
4 changed files
with
93 additions
and
1 deletion.
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 @@ | ||
node_modules/ |
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,14 @@ | ||
FROM node:8.9.4-alpine | ||
|
||
# For deploying the gh-pages | ||
RUN apk update && apk upgrade && \ | ||
apk add --no-cache bash git openssh | ||
|
||
ENV CI true | ||
COPY package*.json ./ | ||
RUN npm install --ignore-scripts | ||
|
||
COPY . . | ||
EXPOSE 6006 | ||
CMD ["npm", "start"] | ||
|
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,77 @@ | ||
#!/usr/bin/env groovy | ||
|
||
@Library('sec_ci_libs@v2-latest') _ | ||
|
||
def master_branches = ["master", ] as String[] | ||
|
||
pipeline { | ||
agent { | ||
dockerfile { | ||
args '--shm-size=2g' | ||
} | ||
} | ||
|
||
environment { | ||
JENKINS_VERSION = 'yes' | ||
} | ||
|
||
options { | ||
timeout(time: 1, unit: 'HOURS') | ||
} | ||
|
||
stages { | ||
stage('Authorization') { | ||
steps { | ||
user_is_authorized(master_branches, '8b793652-f26a-422f-a9ba-0d1e47eb9d89', '#frontend-dev') | ||
} | ||
} | ||
|
||
stage('Initialization') { | ||
steps { | ||
ansiColor('xterm') { | ||
retry(2) { | ||
sh '''npm install''' | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Unit Test') { | ||
steps { | ||
ansiColor('xterm') { | ||
sh '''npm run test''' | ||
} | ||
} | ||
} | ||
|
||
stage('Build') { | ||
steps { | ||
ansiColor('xterm') { | ||
sh '''npm run dist''' | ||
} | ||
} | ||
|
||
post { | ||
always { | ||
archiveArtifacts 'dist/*' | ||
} | ||
} | ||
} | ||
|
||
stage('Deploy'){ | ||
when { | ||
expression { env.BRANCH_NAME == 'master' } | ||
} | ||
|
||
steps { | ||
// we need to do this workaround as jenkins clones without .git/ directory | ||
sh '''rm -rf ui-kit && git clone https://github.com/dcos-labs/ui-kit.git && cd ui-kit && npm install''' | ||
withCredentials([ | ||
string(credentialsId: '1f0a31fe-30eb-11e8-b467-0ed5f89f718b', variable: 'GITHUB_TOKEN') | ||
]) { | ||
sh '''cd ui-kit && npm run deploy:storybook -- --ci --host-token-env-variable=GITHUB_TOKEN''' | ||
} | ||
} | ||
} | ||
} | ||
} |
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