Rename com.meesho/org.meesho namespace to com.homelab/org.homelab
Renames src/com/meesho -> src/com/homelab, resources/com/meesho -> resources/com/homelab, resources/org/meesho -> resources/org/homelab (via git mv, preserving history), and sweeps every remaining occurrence of "meesho" (any casing) out of package declarations, imports, libraryResource() paths, and comments across the whole repo. Also drops the per-user allowlist in vars/eksCICD.groovy, which hardcoded real former-colleagues' emails and doesn't apply to a single-person homelab — that branch is now permanently skipped rather than deleted outright, to avoid hand-editing the escape-sequence-heavy echo blocks it guards (eksCICD.groovy itself is unused legacy code, not called by homelabPipeline.groovy). Does not touch the ~114 files that were already missing from the working tree but still tracked in the prior commit — that's unrelated pre-existing state, left as-is.
This commit is contained in:
@@ -0,0 +1,391 @@
|
||||
|
||||
package com.homelab.utilities
|
||||
|
||||
def getWhitelistedRepos(fileName){
|
||||
dir('whitelist'){
|
||||
git(
|
||||
url: "https://github.com/Homelab/whitelists.git",
|
||||
branch: "main",
|
||||
credentialsId: 'cicd-github-app',
|
||||
)}
|
||||
def yaml = readYaml file: "whitelist/${fileName}.yaml"
|
||||
return yaml.get("repos", []) as Set
|
||||
}
|
||||
|
||||
def getWhitelistedDeployable(fileName, keyName){
|
||||
dir('whitelist'){
|
||||
git(
|
||||
url: "https://github.com/Homelab/whitelists.git",
|
||||
branch: "main",
|
||||
credentialsId: 'cicd-github-app',
|
||||
)}
|
||||
def yaml = readYaml file: "whitelist/${fileName}.yaml"
|
||||
return yaml.get(keyName, []) as Set
|
||||
}
|
||||
|
||||
/*
|
||||
* return `true` if we should not proceed
|
||||
*/
|
||||
def isMultizoneEnabled( String deployable){
|
||||
def WHITELIST = getWhitelistedDeployable("multizone-enabled-repos" , "multizone_enabled_deployables")
|
||||
if (WHITELIST.contains(deployable)) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/*
|
||||
* return `true` if we should not proceed
|
||||
*/
|
||||
def skipSonarCheckForbidden(Map config, Map environment_map) {
|
||||
def branch = env.BRANCH_NAME
|
||||
def environment = environment_map.getOrDefault(branch, "int")
|
||||
|
||||
def WHITELIST = getWhitelistedRepos("skip-sonar-whitelist")
|
||||
|
||||
// returns 'true' if we aren't skipping sonar
|
||||
// or if we're allowed to skip sonar
|
||||
def build_version = config['dockerBuildVersion']
|
||||
def repo_name = config['repo_name']
|
||||
|
||||
// if not a maven build OR if it a hotfix we exit early and don’t care what skip_sonar is
|
||||
if (WHITELIST.contains(repo_name)|| !(build_version.contains("maven")) || environment != "prd" || branch.contains("hotfix")){
|
||||
return false;
|
||||
}
|
||||
|
||||
return config['skip_sonar'];
|
||||
}
|
||||
|
||||
def skipSonarCheckForGo(Map config) {
|
||||
def branch = env.BRANCH_NAME
|
||||
def WHITELIST = getWhitelistedRepos("skip-sonar-whitelist")
|
||||
def build_version = config['dockerBuildVersion']
|
||||
def repo_name = config['repo_name']
|
||||
echo "env.INFRA_ENV: ${env.INFRA_ENV}"
|
||||
if (WHITELIST.contains(repo_name)|| branch.contains("hotfix")|| env.INFRA_ENV == "toolchain"){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
* return `true` if we should not proceed
|
||||
*/
|
||||
def appConfigDisabledForbidden(boolean appConfigEnabled, String repo_name, String environment, String build_version){
|
||||
def branch = env.CHANGE_TARGET
|
||||
def WHITELIST = getWhitelistedRepos("app-config-disabled")
|
||||
if (WHITELIST.contains(repo_name) || environment!="stg"){
|
||||
return false
|
||||
}
|
||||
if (!(build_version.contains("maven") || build_version.contains("gradle"))){
|
||||
return false
|
||||
}
|
||||
return !appConfigEnabled
|
||||
}
|
||||
|
||||
/*
|
||||
* return `true` if we should not proceed
|
||||
*/
|
||||
def allowedNonDevelopPrDeploymentToIntRepos( String repo_name){
|
||||
def WHITELIST = getWhitelistedRepos("allowedNonDevelopPrDeploymentToInt")
|
||||
if (WHITELIST.contains(repo_name)) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/*
|
||||
* return `true` if we should not proceed
|
||||
*/
|
||||
def ValidateCacConfigForRepo(boolean ValidateConfig, String repo_name ){
|
||||
def branch = env.CHANGE_TARGET
|
||||
def WHITELIST = getWhitelistedRepos("ValidateCacConfig")
|
||||
if (WHITELIST.contains(repo_name)) {
|
||||
return true
|
||||
}
|
||||
return ValidateConfig
|
||||
}
|
||||
|
||||
def getToolchainEnv() {
|
||||
def paramsAction = currentBuild.rawBuild.getAction(hudson.model.ParametersAction.class)
|
||||
if (paramsAction) {
|
||||
echo "paramsAction: ${paramsAction}"
|
||||
def p = paramsAction.getParameter("TOOLCHAIN_ENV")
|
||||
echo "p: ${p}"
|
||||
if (p) {
|
||||
return p.getValue()?.toString()
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
def run(Map config) {
|
||||
def branch_name = env.BRANCH_NAME
|
||||
if (env.INFRA_ENV == 'toolchain' && (config.build_tool?.startsWith('node-') || config.dockerBuildVersion?.startsWith('node-'))) {
|
||||
branch_name = 'develop' // develop maps to stg in the environment_map
|
||||
def tcEnv = getToolchainEnv()
|
||||
env.TOOLCHAIN_ENV = tcEnv
|
||||
log.info("Successfully extracted TOOLCHAIN_ENV from trigger cause: ${env.TOOLCHAIN_ENV}")
|
||||
}
|
||||
def environment_map = ['master':'prd', 'main':'prd', 'develop':'stg', 'gcp-main':'prd', 'farmiso-main':'prd', 'gcp-master':'prd', 'gcp-dev':'stg']
|
||||
env.skip_user_input = config.skip_user_input ?: false
|
||||
|
||||
// don't allow skip_sonar
|
||||
if (skipSonarCheckForbidden(config, environment_map)){
|
||||
throw new Exception("Not allowed to skip sonar (skip_sonar in config.yaml)")
|
||||
}
|
||||
|
||||
if (env.CHANGE_ID) {
|
||||
branch_name = env.CHANGE_TARGET
|
||||
environment_map = ['master':'int', 'main':'int', 'gcp-main':'int', 'farmiso-main':'int', 'gcp-master':'int', 'develop':'ftr', 'gcp-dev':'ftr']
|
||||
}
|
||||
environment_map[branch_name] = environment_map[branch_name] ?: 'ftr'
|
||||
|
||||
if (config.containsKey('branch_params')) {
|
||||
Map branch_config = config['branch_params'].collectEntries { key, value -> branch_name.matches(key) ? value : [ : ] }
|
||||
config.remove('branch_params')
|
||||
config.putAll(branch_config)
|
||||
}
|
||||
if (config.containsKey('environment')) {
|
||||
Map envrionment_config = config['environment'].collectEntries { key, value -> environment_map[branch_name].matches(key) ? value : [ : ] }
|
||||
config.remove('environment')
|
||||
config.putAll(envrionment_config)
|
||||
}
|
||||
|
||||
env.GITHUB_CRED = 'svc-devops-homelab'
|
||||
env.cicd_environment = environment_map[branch_name]
|
||||
env.helm_repo_name = 'devops-helm-charts'
|
||||
env.argo_repo_name = 'devops-argo-config'
|
||||
|
||||
echo "Branch Name - ${branch_name} and Environment - ${env.cicd_environment}"
|
||||
if (env.CLOUD_PROVIDER == 'AWS') {
|
||||
def prodAccountID = '847438129436'
|
||||
def prodRegion = 'ap-southeast-1'
|
||||
def prodObjBucket = 'homelab-prod-artifacts'
|
||||
def devAccountID = '766380763301'
|
||||
def devObjBucket = 'homelab-stg-artifacts'
|
||||
def devRegion = 'ap-south-1'
|
||||
def accountDetails = [
|
||||
'prd': [
|
||||
'accountID': prodAccountID,
|
||||
'region': prodRegion,
|
||||
'objBucket': prodObjBucket
|
||||
],
|
||||
'int': [
|
||||
'accountID': prodAccountID,
|
||||
'region': prodRegion,
|
||||
'objBucket': prodObjBucket
|
||||
],
|
||||
'stg': [
|
||||
'accountID': devAccountID,
|
||||
'region': devRegion,
|
||||
'objBucket': devObjBucket
|
||||
],
|
||||
'ftr': [
|
||||
'accountID': devAccountID,
|
||||
'region': devRegion,
|
||||
'objBucket': devObjBucket
|
||||
]
|
||||
]
|
||||
env.accountID = accountDetails[env.cicd_environment]['accountID']
|
||||
env.region = accountDetails[env.cicd_environment]['region']
|
||||
env.registry = "${env.accountID}.dkr.ecr.${env.region}.amazonaws.com"
|
||||
env.buildRegistry = env.registry
|
||||
env.helmChartsPath = 'charts'
|
||||
env.defaultHelmChartVersion = '1.0.10'
|
||||
env.objBucket = accountDetails[env.cicd_environment]['objBucket']
|
||||
env.skip_notify = false
|
||||
echo "${env.accountID}.dkr.ecr.${env.region}.amazonaws.com"
|
||||
}
|
||||
else if (env.CLOUD_PROVIDER == 'GCP') {
|
||||
def prodVaultURL = 'https://vault-prd.homelabgcp.in'
|
||||
def prodVaultToken = 'vault-prd-token'
|
||||
def prodSonarURL = 'https://sonarqube-prd.homelabgcp.in'
|
||||
def prodSonarToken = 'sonar-token-prod'
|
||||
def prodSonarEnv = 'sonarqube-test'
|
||||
def prodGoProxyUrl = 'https://athens-prd.homelabgcp.in'
|
||||
def prdDockerHost = 'dind-prd-svc'
|
||||
def preProdDockerHost = 'dind-int-svc'
|
||||
def prodGCPProject = "homelab-${config.bu}-prd-0622"
|
||||
def preprodGCPProject = "homelab-shared-int-0525"
|
||||
def devVaultURL = 'https://vault-dev.homelabgcp.in'
|
||||
def devVaultToken = 'vault-dev-token'
|
||||
def devSonarURL = "https://sonarqube-${config.bu}-dev.homelabgcp.in"
|
||||
def devSonarToken = "sonar-token-${config.bu}-dev"
|
||||
def devSonarEnv = "sonar-${config.bu}-dev"
|
||||
def devGoProxyUrl = 'https://athens-dev.homelabgcp.in'
|
||||
def devGCPProject = "homelab-${config.bu}-dev-0622"
|
||||
def devDockerHost = 'dind-dev-new-svc.jenkins-new.svc.cluster.local'
|
||||
def toolchainDockerHost = 'toolchain-dind-dev-svc.jenkins-toolchain.svc.cluster.local'
|
||||
def accountDetails = [
|
||||
'prd': [
|
||||
'vaultURL': prodVaultURL,
|
||||
'vaultToken': prodVaultToken,
|
||||
'sonarURL': prodSonarURL,
|
||||
'sonarToken': prodSonarToken,
|
||||
'GCPProject': prodGCPProject,
|
||||
'sonarEnv': prodSonarEnv,
|
||||
'GCPLBProject': prodGCPProject,
|
||||
'goProxyUrl': prodGoProxyUrl,
|
||||
'dockerHost': prdDockerHost
|
||||
],
|
||||
'int': [
|
||||
'vaultURL': prodVaultURL,
|
||||
'vaultToken': prodVaultToken,
|
||||
'sonarURL': prodSonarURL,
|
||||
'sonarToken': prodSonarToken,
|
||||
'GCPProject': preprodGCPProject,
|
||||
'sonarEnv': prodSonarEnv,
|
||||
'GCPLBProject': prodGCPProject,
|
||||
'goProxyUrl': prodGoProxyUrl,
|
||||
'dockerHost': preProdDockerHost
|
||||
],
|
||||
'stg': [
|
||||
'vaultURL': devVaultURL,
|
||||
'vaultToken': devVaultToken,
|
||||
'sonarURL': devSonarURL,
|
||||
'sonarToken': devSonarToken,
|
||||
'GCPProject': devGCPProject,
|
||||
'sonarEnv': devSonarEnv,
|
||||
'GCPLBProject': devGCPProject,
|
||||
'goProxyUrl': devGoProxyUrl,
|
||||
'dockerHost': devDockerHost
|
||||
],
|
||||
'ftr': [
|
||||
'vaultURL': devVaultURL,
|
||||
'vaultToken': devVaultToken,
|
||||
'sonarURL': devSonarURL,
|
||||
'sonarToken': devSonarToken,
|
||||
'GCPProject': devGCPProject,
|
||||
'sonarEnv': devSonarEnv,
|
||||
'GCPLBProject': devGCPProject,
|
||||
'goProxyUrl': devGoProxyUrl,
|
||||
'dockerHost': devDockerHost ]
|
||||
]
|
||||
env.GCPProject = accountDetails[env.cicd_environment]['GCPProject']
|
||||
env.GCPLBProject = accountDetails[env.cicd_environment]['GCPLBProject']
|
||||
env.registry = 'asia-southeast1-docker.pkg.dev/homelab-devops-admin-0622'
|
||||
if (env.INFRA_ENV == 'toolchain') {
|
||||
env.registry = 'asia-southeast1-docker.pkg.dev/homelab-central-dev-0622/toolchain'
|
||||
}
|
||||
env.buildRegistry = 'asia-southeast1-docker.pkg.dev/homelab-devops-admin-0622/admin'
|
||||
env.helmChartsPath = env.cicd_environment == 'prd' ? 'values_v3' : 'values_v2'
|
||||
env.defaultHelmChartVersion = '2.0.0'
|
||||
env.objBucket = "gcs-infr-dvps-homelab-artifacts-${env.cicd_environment}"
|
||||
env.vaultURL = accountDetails[env.cicd_environment]['vaultURL']
|
||||
env.vaultToken = accountDetails[env.cicd_environment]['vaultToken']
|
||||
env.sonarURL = accountDetails[env.cicd_environment]['sonarURL']
|
||||
env.sonarToken = accountDetails[env.cicd_environment]['sonarToken']
|
||||
env.sonarEnv = accountDetails[env.cicd_environment]['sonarEnv']
|
||||
env.goProxyUrl = accountDetails[env.cicd_environment]['goProxyUrl']
|
||||
env.skip_notify = true
|
||||
env.DOCKER_HOST = accountDetails[env.cicd_environment]['dockerHost']
|
||||
if (env.INFRA_ENV == 'toolchain') {
|
||||
env.DOCKER_HOST = toolchainDockerHost
|
||||
}
|
||||
}
|
||||
echo "Bucket and Image Repo Details - ${env.registry} ${env.buildRegistry} ${env.objBucket}"
|
||||
echo "Docker Host - ${env.DOCKER_HOST}"
|
||||
}
|
||||
|
||||
def perDeploymentVars(Map value_binding) {
|
||||
env.BU = value_binding.bu
|
||||
echo "${env.BU}"
|
||||
|
||||
if (env.CLOUD_PROVIDER == 'AWS') {
|
||||
def inClusterName = 'https://kubernetes.default.svc'
|
||||
def prodArgoURL = 'prod-ops-argocd.homelab.com'
|
||||
def devArgoURL = 'stg-dev-argocd.homelabtest.in'
|
||||
def prodK8sCluster = [
|
||||
'supply': 'https://211689C65F4496AAA76FE19B29E24B6E.yl4.ap-southeast-1.eks.amazonaws.com',
|
||||
'demand': 'https://9059D138B6277A0EA592BA7F4B680CEC.gr7.ap-southeast-1.eks.amazonaws.com',
|
||||
'dataengg': 'https://806ADE97231CA65D2A0FFB780352630D.yl4.ap-southeast-1.eks.amazonaws.com',
|
||||
'datascience': 'https://E34D119516F751AFD1A61043B0514726.yl4.ap-southeast-1.eks.amazonaws.com',
|
||||
'central': 'https://C95FCEDF7CEE890F531E1D0488BEC6C3.gr7.ap-southeast-1.eks.amazonaws.com',
|
||||
'mcache': 'https://2FFADF214AD8BE58769C5F2797987E50.gr7.ap-southeast-1.eks.amazonaws.com'
|
||||
]
|
||||
def devK8sCluster = [
|
||||
'supply': inClusterName,
|
||||
'demand': inClusterName,
|
||||
'dataengg': inClusterName,
|
||||
'datascience': inClusterName,
|
||||
'central': inClusterName,
|
||||
'mcache': inClusterName
|
||||
]
|
||||
def accountDetails = [
|
||||
'prd': [
|
||||
'argoURL': prodArgoURL,
|
||||
'argoIncubator': 'prod-app-of-apps',
|
||||
'serverMap': prodK8sCluster
|
||||
],
|
||||
'int': [
|
||||
'argoURL': prodArgoURL,
|
||||
'argoIncubator': 'int-app-of-app',
|
||||
'serverMap': prodK8sCluster
|
||||
],
|
||||
'stg': [
|
||||
'argoURL': devArgoURL,
|
||||
'argoIncubator': 'app-of-apps',
|
||||
'serverMap': devK8sCluster
|
||||
],
|
||||
'ftr': [
|
||||
'argoURL': devArgoURL,
|
||||
'argoIncubator': 'ftr-app-of-apps',
|
||||
'serverMap': devK8sCluster
|
||||
]
|
||||
]
|
||||
env.clusterName = accountDetails[env.cicd_environment]['serverMap'][env.BU]
|
||||
env.argoAppsPath = 'applications'
|
||||
env.argoURL = accountDetails[env.cicd_environment]['argoURL']
|
||||
env.argoCreds = 'argocd-jenkins'
|
||||
env.argoIncubator = accountDetails[env.cicd_environment]['argoIncubator']
|
||||
env.argoAppNS = 'argocd'
|
||||
}
|
||||
else if (env.CLOUD_PROVIDER == 'GCP') {
|
||||
def prodArgoURL = "argocd-${env.BU}-prd.homelabgcp.in"
|
||||
def prodArgoCreds = "argocd-${env.BU}-prd-creds"
|
||||
def preprodArgoURL = "argocd-shared-int.homelabgcp.in"
|
||||
def preprodArgoCreds = "argocd-shared-int-creds"
|
||||
def devArgoURL = 'argocd-dev.homelabgcp.in'
|
||||
def devArgoCreds = 'argocd-dev-creds'
|
||||
def accountDetails = [
|
||||
'prd': [
|
||||
'argoURL': prodArgoURL,
|
||||
'argoCreds': prodArgoCreds,
|
||||
'argoAppNS': "argocd-${env.BU}-prd",
|
||||
'clusterName': "k8s-${env.BU}-prd-ase1"
|
||||
],
|
||||
'int': [
|
||||
'argoURL': preprodArgoURL,
|
||||
'argoCreds': preprodArgoCreds,
|
||||
'argoAppNS': "argocd-shared-int",
|
||||
'clusterName': "k8s-shared-int-ase1"
|
||||
],
|
||||
'stg': [
|
||||
'argoURL': devArgoURL,
|
||||
'argoCreds': devArgoCreds,
|
||||
'argoAppNS': "argocd-dev",
|
||||
'clusterName': "k8s-${env.BU}-stg-ase1"
|
||||
],
|
||||
'ftr': [
|
||||
'argoURL': devArgoURL,
|
||||
'argoCreds': devArgoCreds,
|
||||
'argoAppNS': "argocd-dev",
|
||||
'clusterName': "k8s-${env.BU}-stg-ase1"
|
||||
]
|
||||
]
|
||||
|
||||
env.clusterName = accountDetails[env.cicd_environment]['clusterName']
|
||||
|
||||
if (env.cicd_environment == 'int') {
|
||||
env.argoAppsPath = "applications_v2/k8s-${env.BU}-int-ase1"
|
||||
} else {
|
||||
env.argoAppsPath = "applications_v2/${env.clusterName}"
|
||||
}
|
||||
|
||||
env.argoURL = accountDetails[env.cicd_environment]['argoURL']
|
||||
env.argoCreds = accountDetails[env.cicd_environment]['argoCreds']
|
||||
env.argoAppNS = accountDetails[env.cicd_environment]['argoAppNS']
|
||||
env.argoIncubator = "incubator-apps-k8s-${env.BU}-${env.cicd_environment}-ase1"
|
||||
}
|
||||
echo "${env.clusterName} ${env.argoURL} ${env.argoIncubator}"
|
||||
}
|
||||
Reference in New Issue
Block a user