Skip to content

Instantly share code, notes, and snippets.

@terabyte
Created February 28, 2019 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save terabyte/85e4fd75333bd349da0519979144ba48 to your computer and use it in GitHub Desktop.
Save terabyte/85e4fd75333bd349da0519979144ba48 to your computer and use it in GitHub Desktop.
// 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, "infra-eng@cloudera.com", "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 s3@cloudcat.infra.cloudera.com 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 {
archiveArtifacts {
allowEmpty(allowEmptyArtifacts)
}
descriptionSetterPublisher {
regexp('^(GBN .*)')
regexpForFailed('^(GBN .*)')
description("")
descriptionForFailed("")
setForMatrix(false)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment