-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b881fd9
Showing
56 changed files
with
16,563 additions
and
0 deletions.
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,4 @@ | ||
node_modules/ | ||
.idea | ||
.datadrive | ||
deployment |
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,11 @@ | ||
FROM cae-artifactory.jpl.nasa.gov:17001/node:14.15.0 | ||
|
||
ENV HOME . | ||
|
||
RUN apt-get update && \ | ||
apt-get install zip && \ | ||
mkdir -p /usr/src/app | ||
|
||
WORKDIR /usr/src/app | ||
|
||
RUN npm config set @gov.nasa.jpl.m2020.cs3:registry https://cae-artifactory.jpl.nasa.gov:443/artifactory/api/npm/npm-release-local/ |
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,169 @@ | ||
/** | ||
* The following flags can be used to control stages of the pipeline to be run. | ||
*/ | ||
def PIPELINE_CONTROL = [ | ||
ci_skip: false | ||
] | ||
|
||
pipeline { | ||
agent { | ||
dockerfile { | ||
label 'cae-linux-build' | ||
reuseNode true | ||
} | ||
} | ||
|
||
environment { | ||
BASE_NAME = "deployment/dist/ddrv-cli-bundle" | ||
EXT_NAME = "zip" | ||
FILE_NAME = "${BASE_NAME}.${EXT_NAME}" | ||
ARTIFACTORY_FILE_NAME = "${BASE_NAME}-${env.BRANCH_NAME}-${env.BUILD_NUMBER}.${EXT_NAME}" | ||
HOME="." /* to resolve EACCES: permission denied, mkdir '/.npm'*/ | ||
GH4JPL=credentials("eb12d339-d336-48d7-baab-c0ebcbe7eba0") | ||
GH_TOKEN="${GH4JPL_PSW}" | ||
GH_URL="https://github.jpl.nasa.gov/api/v3" | ||
} | ||
|
||
stages { | ||
// "Borrowed" from https://github.com/MarkAckert/staging-zowe-ims-plugin/blob/master/Jenkinsfile | ||
stage('Check for Skip CI') { | ||
steps { | ||
script { | ||
def result = sh (returnStatus: true, script: 'git log -1 | grep \'.*\\[skip ci\\].*\'') | ||
if (result == 0) { | ||
echo '"skip ci" spotted in the git commit. Aborting...' | ||
PIPELINE_CONTROL.ci_skip = true | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage("Prerequisites") { | ||
when { expression { return PIPELINE_CONTROL.ci_skip == false } } | ||
|
||
steps { | ||
sh("npm config set @gov.nasa.jpl.m2020.cs3:registry https://cae-artifactory.jpl.nasa.gov:443/artifactory/api/npm/npm-release-local/") | ||
sh("make install") | ||
} | ||
} | ||
|
||
stage('Test') { | ||
when { expression { return PIPELINE_CONTROL.ci_skip == false } } | ||
|
||
steps { | ||
sh("make test") | ||
} | ||
} | ||
|
||
stage('Package') { | ||
when { | ||
allOf { | ||
expression { return PIPELINE_CONTROL.ci_skip == false } | ||
anyOf { | ||
branch "master" | ||
branch "develop" | ||
} | ||
} | ||
} | ||
steps { | ||
sh("make package") | ||
sh("cp ${FILE_NAME} ${ARTIFACTORY_FILE_NAME}") | ||
} | ||
} | ||
|
||
stage('Artifactory - Build') { | ||
when { | ||
allOf { | ||
expression { return PIPELINE_CONTROL.ci_skip == false } | ||
anyOf { | ||
branch "master" | ||
branch "develop" | ||
} | ||
} | ||
} | ||
steps { | ||
script { | ||
def server = Artifactory.newServer url: 'https://cae-artifactory.jpl.nasa.gov/artifactory', credentialsId: 'f5ab4184-4891-47f6-920e-99e2b85b3f5c' | ||
// Create Upload Spec | ||
//target needs to end with / | ||
def uploadSpec = """ | ||
{"files": [{ | ||
"pattern": "${ARTIFACTORY_FILE_NAME}", | ||
"target": "general-develop/gov/nasa/jpl/ammos/ids/datadrive/" | ||
}]}""" | ||
// Upload to Artifactory. | ||
def buildInfo = server.upload spec: uploadSpec | ||
server.publishBuildInfo buildInfo | ||
} | ||
} | ||
} | ||
|
||
stage('Dry Run Release Github') { | ||
when { | ||
allOf { | ||
branch "master" | ||
expression { return PIPELINE_CONTROL.ci_skip == false } | ||
} | ||
} | ||
steps { | ||
sh ("make release-dry-run") | ||
} | ||
} | ||
|
||
stage('Release Github') { | ||
when { | ||
beforeInput true | ||
allOf { | ||
branch "master" | ||
expression { return PIPELINE_CONTROL.ci_skip == false } | ||
} | ||
} | ||
options { | ||
timeout(time: 1, unit: 'HOURS') | ||
} | ||
input { | ||
message "Does dry run look okay?" | ||
ok "Yes, release!" | ||
} | ||
steps { | ||
sh ("make release") | ||
} | ||
} | ||
|
||
stage('Artifactory - Version') { | ||
when { | ||
allOf { | ||
branch "master" | ||
expression { return PIPELINE_CONTROL.ci_skip == false } | ||
} | ||
} | ||
environment { | ||
RELEASE_VERSION = sh(script: 'cat src/release.txt', returnStdout: true).trim() | ||
} | ||
steps { | ||
sh("cp ${FILE_NAME} ${BASE_NAME}-${RELEASE_VERSION}.${EXT_NAME}") | ||
script { | ||
def server = Artifactory.newServer url: 'https://cae-artifactory.jpl.nasa.gov/artifactory', credentialsId: 'f5ab4184-4891-47f6-920e-99e2b85b3f5c' | ||
// Create Upload Spec | ||
//target needs to end with / | ||
def uploadSpec = """ | ||
{"files": [{ | ||
"pattern": "${BASE_NAME}-${RELEASE_VERSION}.${EXT_NAME}", | ||
"target": "general-develop/gov/nasa/jpl/ammos/ids/datadrive/" | ||
}]}""" | ||
// Upload to Artifactory. | ||
def buildInfo = server.upload spec: uploadSpec | ||
server.publishBuildInfo buildInfo | ||
} | ||
} | ||
} | ||
} | ||
post { | ||
success { | ||
deleteDir() | ||
} | ||
failure { | ||
deleteDir() | ||
} | ||
} | ||
} |
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,13 @@ | ||
COPYRIGHT | ||
|
||
Copyright (c) 2024 California Institute of Technology (“Caltech”). U.S. Government sponsorship acknowledged. | ||
|
||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
Neither the name of Caltech nor its operating division, the Jet Propulsion Laboratory, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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,20 @@ | ||
export NAME ?= datadrive-commandline | ||
export RELEASE_NAME ?= latest | ||
|
||
install: | ||
npm --prefix src/ install | ||
|
||
package: | ||
npm --prefix src/ run package | ||
|
||
build: | ||
docker build -t $(NAME):$(RELEASE_NAME) . | ||
|
||
test: | ||
npm --prefix src/ test | ||
|
||
release: | ||
npm --prefix src/ run semantic-release | ||
|
||
release-dry-run: | ||
npm --prefix src/ run semantic-release-dry-run |
Oops, something went wrong.