Created
February 28, 2019 21:21
-
-
Save terabyte/8a26b3ffdfb1edcf313b3a5796fd84ca to your computer and use it in GitHub Desktop.
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
// Copyright (c) 2019 Cloudera, Inc. All rights reserved. | |
/** | |
* Uploads a new GBN | |
*/ | |
import com.cloudera.dsl.Common | |
freeStyleJob('PublishGenericGBN') { | |
// Adds DSL code for defaults (timestamp and workspace cleanup) | |
Common.defaults(delegate) | |
def description = """ | |
Uploads a new generic GBN artifact. For detailed docs, see <a href="https://github.infra.cloudera.com/Kitchen/tools/blob/master/generic-gbn-uploader/README.md">README.md</a> | |
<br/> | |
Given a URL of a file, such as a tarball, upload a GBN artifact of that file. | |
""" | |
//Adds DSL code for description of jenkins job | |
Common.description(delegate, "[email protected]", "infra", description) | |
// Build enivronment | |
wrappers { | |
preBuildCleanup() | |
timeout { | |
absolute(240) | |
abortBuild() | |
} | |
credentialsBinding { | |
file('S3_ALL_CREDS', 's3-release-creds') | |
} | |
} | |
logRotator { daysToKeep(30) } | |
parameters{ | |
stringParam("PRODUCT","","The product name [REQUIRED]") | |
stringParam("VERSION","","The version number [REQUIRED]") | |
stringParam("PUB_URL","","The url of the file to publish [REQUIRED]") | |
stringParam("REPO","","Repo name the artifact comes from, blank is acceptable") | |
stringParam("REF","","The SHA1 of the artifact's metadata") | |
stringParam("BRANCH","","The branch of the artifact's metadata") | |
stringParam("EXPIRATION","","The expiration (leave blank for 10 days, format is YYYYMMDD-HHMM") | |
} | |
label('cauldron-docker-ubuntu1604-ec2-m4-2xlarge-ondemand') | |
//Common.internalGithub(delegate, 'Kitchen', 'tools', 'master') | |
Common.internalGithub(delegate, 'Kitchen', 'tools', 'cmyers-test') | |
steps { | |
def s='''\ | |
|#!/bin/bash | |
|set -ex | |
|BASE_DIR="$WORKSPACE/generic-gbn-uploader" | |
|rm -rf "$BASE_DIR/build" | |
|mkdir -p "$BASE_DIR/build" | |
|cd "$BASE_DIR" | |
|wget "$PUB_URL" | |
| | |
|# get credentials | |
|ssh -o StrictHostKeyChecking=no [email protected] build > "$BASE_DIR/build/awscreds" | |
| | |
|PUB_FILE="$(basename "$PUB_URL")" PRODUCT="$PRODUCT" VERSION="$VERSION" REPO="$REPO" REF="$REF" BRANCH="$BRANCH" EXPIRATION="$EXPIRATION" ./run-in-docker.sh | |
| | |
|'''.stripMargin('|') | |
shell(s) | |
} | |
publishers { | |
descriptionSetterPublisher { | |
regexp('^(GBN .*)') | |
regexpForFailed('^(GBN .*)') | |
description("") | |
descriptionForFailed("") | |
setForMatrix(false) | |
} | |
wsCleanup() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment