This file contains hidden or 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
| terraform { | |
| source = "tfr:///terraform-aws-modules/vpc/aws?version=3.14.2" | |
| } |
This file contains hidden or 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
| ######################################## | |
| ## CONFIG | Airflow Configs | |
| ######################################## | |
| airflow: | |
| extraPipPackages: | |
| - "datadog==0.42.0" | |
| - "apache-airflow[statsd]" | |
| config: | |
| AIRFLOW__METRICS__STATSD_ON: true | |
| AIRFLOW__METRICS__STATSD_HOST: "localhost" |
This file contains hidden or 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
| version: '3.1' | |
| services: | |
| ccloud_exporter: | |
| ports: | |
| - 2112:2112 | |
| image: dabz/ccloudexporter | |
| environment: | |
| CCLOUD_USER: ${CCLOUD_USER} | |
| CCLOUD_PASSWORD: ${CCLOUD_PASSWORD} | |
| command: -cluster ${CCLOUD_CLUSTER} |
This file contains hidden or 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
| '''Example code of the SecretManager class''' | |
| class SecretManager(object): | |
| def __init__(self, serviceName, environment, awsRegion="us-east-1", filepath=""): | |
| try: | |
| self.SERVICE_NAME = serviceName.lower() | |
| self.ENVIRONMENT = environment.lower() | |
| self.FILEPATH = filepath | |
| self.ssm = self.initSSM(awsRegion) | |
| self.CREDENTIAL_KEY_PREFIX = "cred" |
This file contains hidden or 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
| '''Example code of the SecretManagerTest class''' | |
| import unittest, os.path | |
| from os.path import dirname, abspath | |
| import SecretManager | |
| class SecretManagerTest(unittest.TestCase): | |
| SERVICE_NAME = "helloWorld" | |
| ENVIRONMENT = "test" | |
| FILEPATH = os.path.join(dirname(dirname(abspath(os.path.dirname( __file__ )))), 'ssm.json') |
This file contains hidden or 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
| def check_runs = new com.functions.buildGithubCheckScript() | |
| pipeline { | |
| agent { | |
| kubernetes { | |
| label "GitHub-Check-Runs-${UUID.randomUUID().toString().substring(0,8)}" | |
| defaultContainer 'jnlp' | |
| } | |
| } | |
| stages { |
This file contains hidden or 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
| @Grab(group='io.jsonwebtoken', module='jjwt', version='0.4') | |
| import sun.net.www.protocol.https.HttpsURLConnectionImpl | |
| import java.text.SimpleDateFormat | |
| import java.lang.reflect.* | |
| import java.util.* | |
| import java.nio.charset.StandardCharsets | |
| import java.io.* | |
| import javax.crypto.KeyGenerator | |
| import java.security.* | |
| import groovy.json.* |
This file contains hidden or 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
| // Custom HTTP request method | |
| def setRequestMethod(HttpURLConnection c, String requestMethod) { | |
| try { | |
| final Object target; | |
| if (c instanceof HttpsURLConnectionImpl) { | |
| final Field delegate = HttpsURLConnectionImpl.class.getDeclaredField("delegate"); | |
| delegate.setAccessible(true); | |
| target = delegate.get(c); | |
| } else { | |
| target = c; |
This file contains hidden or 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
| def getRSAPrivateKey(privateKey) { | |
| try { | |
| String privateKeyPEM = readFile privateKey | |
| privateKeyPEM = privateKeyPEM.replace("-----BEGIN CERTIFICATE-----\n", ""); | |
| privateKeyPEM = privateKeyPEM.replace("-----END CERTIFICATE-----", ""); | |
| byte[] encoded = Base64.decodeBase64(privateKeyPEM); | |
| KeyFactory kf = KeyFactory.getInstance("RSA"); | |
| PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(encoded); | |
| RSAPrivateKey privKey = (RSAPrivateKey) kf.generatePrivate(keySpec); |
This file contains hidden or 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
| def buildGithubCheck(repository, commitID, privateKey, status, checkName) { | |
| def currentTime = new Date().format("yyyy-MM-dd'T'HH:mm:ss'Z'") | |
| def checkName_run_id | |
| jsonWebToken = getJsonWebToken(privateKey) | |
| getStatusCode = validateAuth(jsonWebToken) | |
| if (!(getStatusCode in [200,201])) { | |
| error "Authentication request failed, status code: ${getStatusCode}" | |
| } | |
| token = getToken(jsonWebToken) |