Initial commit: Spicy CDK automation framework
Jenkins shared library and CDK constructs for AWS infrastructure. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
100
vars/accounts.groovy
Normal file
100
vars/accounts.groovy
Normal file
@@ -0,0 +1,100 @@
|
||||
/**
|
||||
* Account configuration for Spicy CDK pipelines
|
||||
*
|
||||
* This file defines AWS account configurations that can be referenced
|
||||
* in Jenkinsfiles. Customize this for your organization.
|
||||
*
|
||||
* Usage:
|
||||
* def myAccount = accounts.get().SPICY_CA_CENTRAL_1_DEV
|
||||
*/
|
||||
|
||||
def get() {
|
||||
return getAccountsWithEnvironments()
|
||||
}
|
||||
|
||||
def getAccountsWithEnvironments() {
|
||||
return getAccounts() + getDevelopment() + getSandbox() + getStaging() + getProduction()
|
||||
}
|
||||
|
||||
/**
|
||||
* Base account configurations (without environment-specific settings)
|
||||
*/
|
||||
def getAccounts() {
|
||||
def accounts = [:]
|
||||
|
||||
// Example: Spicy AWS Account in ca-central-1
|
||||
accounts.put("SPICY_CA_CENTRAL_1", [
|
||||
accountId: env.AWS_ACCOUNT_ID ?: "123456789012",
|
||||
region: "ca-central-1",
|
||||
jenkinsAwsCredentialsId: "aws-credentials"
|
||||
])
|
||||
|
||||
return accounts
|
||||
}
|
||||
|
||||
/**
|
||||
* Development environment configuration
|
||||
*/
|
||||
def getDevelopment() {
|
||||
def accounts = [:]
|
||||
def base = getAccounts().SPICY_CA_CENTRAL_1
|
||||
|
||||
accounts.put("SPICY_CA_CENTRAL_1_DEV", base + [
|
||||
environmentName: "development",
|
||||
vpcStackName: "vpc-dev",
|
||||
ecsClusterName: "cluster-dev",
|
||||
])
|
||||
|
||||
return accounts
|
||||
}
|
||||
|
||||
/**
|
||||
* Sandbox environment configuration
|
||||
*/
|
||||
def getSandbox() {
|
||||
def accounts = [:]
|
||||
def base = getAccounts().SPICY_CA_CENTRAL_1
|
||||
|
||||
accounts.put("SPICY_CA_CENTRAL_1_SANDBOX", base + [
|
||||
environmentName: "sandbox",
|
||||
vpcStackName: "vpc-sandbox",
|
||||
ecsClusterName: "cluster-sandbox",
|
||||
])
|
||||
|
||||
return accounts
|
||||
}
|
||||
|
||||
/**
|
||||
* Staging environment configuration
|
||||
*/
|
||||
def getStaging() {
|
||||
def accounts = [:]
|
||||
def base = getAccounts().SPICY_CA_CENTRAL_1
|
||||
|
||||
accounts.put("SPICY_CA_CENTRAL_1_STAGING", base + [
|
||||
environmentName: "staging",
|
||||
vpcStackName: "vpc-staging",
|
||||
ecsClusterName: "cluster-staging",
|
||||
])
|
||||
|
||||
return accounts
|
||||
}
|
||||
|
||||
/**
|
||||
* Production environment configuration
|
||||
*/
|
||||
def getProduction() {
|
||||
def accounts = [:]
|
||||
def base = getAccounts().SPICY_CA_CENTRAL_1
|
||||
|
||||
accounts.put("SPICY_CA_CENTRAL_1_PROD", base + [
|
||||
environmentName: "production",
|
||||
vpcStackName: "vpc-prod",
|
||||
ecsClusterName: "cluster-prod",
|
||||
])
|
||||
|
||||
return accounts
|
||||
}
|
||||
|
||||
return this
|
||||
|
||||
Reference in New Issue
Block a user