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.
116 lines
5.8 KiB
Groovy
116 lines
5.8 KiB
Groovy
pipeline {
|
|
agent {
|
|
kubernetes {
|
|
yamlFile "resources/org/homelab/${env.INFRA_ENV}-pod.yaml"
|
|
defaultContainer 'devops-tools'
|
|
}
|
|
}
|
|
|
|
environment {
|
|
GITHUB_CRED = 'svc-devops-homelab'
|
|
}
|
|
|
|
parameters {
|
|
string(name: 'repo_name', defaultValue: '', trim: true, description: 'Please enter repo name.')
|
|
string(name: 'branch_name', defaultValue: 'main', trim: true, description: 'Please enter branch name.')
|
|
choice(name: 'jdk_version', choices: ['jdk8', 'jdk11', 'jdk17', 'jdk21', 'jdk25'], description: 'Please select JDK Version. For adding new JDK Version, please contact DevOps Team.')
|
|
booleanParam(name: 'skip_tests', defaultValue: true, description: 'This option will skip tests while mvn build.')
|
|
booleanParam(name: 'sonar_scan', defaultValue: true, description: 'This option will perform static analysis of code via SonarQube.')
|
|
booleanParam(name: 'sub_modules', defaultValue: false, description: 'This option will enable the use of Git submodules.')
|
|
}
|
|
|
|
stages {
|
|
stage('Validate Params') {
|
|
steps {
|
|
script {
|
|
echo '####################### Validating Parameters ###########################'
|
|
echo "Repo Name: ${params.repo_name}"
|
|
echo "Branch Name: ${params.branch_name}"
|
|
echo "JDK Version: ${params.jdk_version}"
|
|
echo "Skip Tests: ${params.skip_tests}"
|
|
echo "Sonar Scan: ${params.sonar_scan}"
|
|
echo "Sub module: ${params.sub_modules}"
|
|
}
|
|
}
|
|
}
|
|
stage('Build') {
|
|
steps {
|
|
ansiColor('xterm') {
|
|
script {
|
|
sh 'whoami'
|
|
def extra_args = ''
|
|
if (env.INFRA_ENV == 'prd') {
|
|
jfrog_repo = '-DuseProdRepo=true'
|
|
}
|
|
else {
|
|
jfrog_repo = '-DuseTestRepo=true'
|
|
}
|
|
if (skip_tests.toBoolean()) {
|
|
extra_args = '-DskipTests'
|
|
}
|
|
withCredentials([gitUsernamePassword(credentialsId: "${env.GITHUB_CRED}", gitToolName: 'git-tool')]) {
|
|
sh "git clone -b ${branch_name} https://github.com/Homelab/${repo_name}.git"
|
|
}
|
|
if (sub_modules.toBoolean()) {
|
|
dir("${repo_name}") {
|
|
withCredentials([gitUsernamePassword(credentialsId: "${env.GITHUB_CRED}", gitToolName: 'git-tool')]) {
|
|
sh(script:'git submodule init && git submodule update && git submodule update --recursive --remote')
|
|
}
|
|
}
|
|
}
|
|
|
|
def effective_jdk = params.jdk_version
|
|
dir("${repo_name}") {
|
|
if (fileExists('config.yaml')) {
|
|
def config = readYaml file: 'config.yaml'
|
|
def dv = config?.dockerBuildVersion?.toString() ?: ''
|
|
def matcher = (dv =~ /maven-.*-jdk-(\d+)/)
|
|
if (matcher) {
|
|
effective_jdk = "jdk${matcher[0][1]}"
|
|
echo "Using JDK from config.yaml dockerBuildVersion: ${dv} -> ${effective_jdk}"
|
|
}
|
|
}
|
|
}
|
|
if (effective_jdk == 'jdk25') {
|
|
env.JAVA_HOME = '/usr/lib/jvm/java-25-openjdk-amd64/'
|
|
}
|
|
else if (effective_jdk == 'jdk21') {
|
|
env.JAVA_HOME = '/usr/lib/jvm/java-21-openjdk-amd64/'
|
|
}
|
|
else if (effective_jdk == 'jdk17') {
|
|
env.JAVA_HOME = '/usr/lib/jvm/java-17-openjdk-amd64/'
|
|
}
|
|
else if (effective_jdk == 'jdk11') {
|
|
env.JAVA_HOME = '/usr/lib/jvm/java-11-openjdk-amd64/'
|
|
}
|
|
else {
|
|
env.JAVA_HOME = '/usr/lib/jvm/java-8-openjdk-amd64/'
|
|
}
|
|
echo "Resolved JAVA_HOME: ${env.JAVA_HOME} (effective_jdk: ${effective_jdk})"
|
|
dir("${repo_name}") {
|
|
echo '####################### Building Artifacts ###########################'
|
|
sh """
|
|
pwd
|
|
ls -al
|
|
mvn -v
|
|
mvn clean install ${extra_args}
|
|
"""
|
|
if (sonar_scan.toBoolean()) {
|
|
withSonarQubeEnv('sonarqube-test') {
|
|
echo '####################### Performing Sonar Scan ###########################'
|
|
sh(script: "JAVA_HOME='${env.JAVA_HOME}' mvn sonar:sonar -Dsonar.branch.name=${branch_name} -Dsonar.projectName=${repo_name}")
|
|
}
|
|
}
|
|
else {
|
|
echo '####################### Skipping Sonar Scan ###########################'
|
|
}
|
|
echo '####################### Pushing Artifacts to Jfrog ###########################'
|
|
sh(script: "mvn package deploy -DskipTests=${skip_tests} ${jfrog_repo}")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|