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

Script to activate license #117

Merged
merged 3 commits into from Dec 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 35 additions & 0 deletions set-License-activation.groovy
@@ -0,0 +1,35 @@
/**
Author: escoem
Since: November 2018
Description: Activate an existing license for a specific instance
Parameters:
key License Key
certificate License Certificate
Scope: Cloudbees Jenkins Operations Center
Test on: CloudBees Jenkins Operations Center 2.190.3.2-rolling, CloudBees License Manager 9.35
**/

import java.util.logging.Logger
import hudson.license.LicenseManager

Logger logger = Logger.getLogger("008-license.groovy")

logger.info("-----> LICENSE <-----")

LicenseManager lm = LicenseManager.getInstance()

String key = """-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAqPdN72dwL3BV21fDTIRAFR+e7Tx86iT699FeGGMhHFtqs0S6
[...]
d7OLnYcV0mYectBGblNFs/eVJEHM9uK3xjzNkaQCGSmoNsIrHZevDA==
-----END RSA PRIVATE KEY-----
"""

String certificate = """-----BEGIN CERTIFICATE-----
MIIGFTCCBP2gAwIBAgIEASFTGTANBgkqhkiG9w0BAQUFADCBsTELMAkGA1UEBhMC
[...]
HRof/9mcnnDlyC+1iPRomWaIMaVus2JOdQ==
-----END CERTIFICATE-----
"""

lm.setLicense(key, certificate)