feat(dependencies): add requirementsFile validation and caching for pip installations; update timeout to 120 minutes; set image tags to 0.0.0; configure payment ingress

Signed-off-by: zhenyus <zhenyus@mathmast.com>
This commit is contained in:
zhenyus 2025-02-22 23:11:15 +08:00
parent 7b00ee94ee
commit e53b6b03b5
7 changed files with 47 additions and 8 deletions

View File

@ -52,7 +52,24 @@ class DependenciesResolver {
switch (mgr) {
case DependenciesManager.PIP:
steps.log.warn("Dependencies Resolver","Python project no need to resolving dependencies, skipping...")
if (configurations.requirementsFile == null || configurations.requirementsFile.isEmpty()) {
steps.error("requirementsFile is required when using PIP as dependencies manager")
}
def requirementsFile = configurations.requirementsFile
if (cachingEnabled) {
steps.dir(this.workspace) {
steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', cacheName: "${component.name}-pip-cache", includes: '**/*', path: '.pip-cache', cacheValidityDecidingFile: 'requirements.txt']]) {
steps.sh "pip install --cache-dir .pip-cache -r ${requirementsFile}"
}
}
} else {
steps.dir(this.workspace) {
steps.sh "pip install -r ${requirementsFile}"
}
}
break
case DependenciesManager.NPM:
if (configurations.npmPackageJsonFile == null || configurations.npmPackageJsonFile.isEmpty()) {
@ -65,7 +82,7 @@ class DependenciesResolver {
if (cachingEnabled) {
steps.dir(this.workspace) {
steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', path: '.npm-cache', cacheValidityDecidingFile: 'package-lock.json']]) {
steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', cacheName: "${component.name}-npm-cache", includes: '**/*', path: '.npm-cache', cacheValidityDecidingFile: 'package-lock.json']]) {
steps.sh "npm install --cache .npm-cache --prefer-offline --no-audit"
}
}
@ -87,7 +104,7 @@ class DependenciesResolver {
if (cachingEnabled) {
steps.dir(this.workspace) {
steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', path: '.yarn-cache', cacheValidityDecidingFile: 'yarn.lock']]) {
steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', cacheName: "${component.name}-pnpm-cache", path: '.yarn-cache', cacheValidityDecidingFile: 'yarn.lock']]) {
steps.sh "yarn install --cache-folder .yarn-cache --prefer-offline"
}
}

View File

@ -633,7 +633,7 @@ def call(Closure closure) {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '25'))
timeout(time: 30, unit: 'MINUTES')
timeout(time: 120, unit: 'MINUTES')
parallelsAlwaysFailFast()
}

View File

@ -15,6 +15,7 @@ executeFreeleapsPipeline {
root: 'apps/authentication',
language: 'python',
dependenciesManager: 'pip',
requirementsFile: 'requirements.txt',
buildCacheEnabled: true,
buildAgentImage: 'python:3.10-slim-buster',
buildArtifacts: ['.'],
@ -35,6 +36,7 @@ executeFreeleapsPipeline {
root: 'apps/central_storage',
language: 'python',
dependenciesManager: 'pip',
requirementsFile: 'requirements.txt',
buildAgentImage: 'python:3.10-slim-buster',
buildArtifacts: ['.'],
buildCacheEnabled: true,
@ -55,6 +57,7 @@ executeFreeleapsPipeline {
root: 'apps/content',
language: 'python',
dependenciesManager: 'pip',
requirementsFile: 'requirements.txt',
buildAgentImage: 'python:3.10-slim-buster',
buildArtifacts: ['.'],
buildCacheEnabled: true,
@ -75,6 +78,7 @@ executeFreeleapsPipeline {
root: 'apps/notification',
language: 'python',
dependenciesManager: 'pip',
requirementsFile: 'requirements.txt',
buildAgentImage: 'python:3.10-slim-buster',
buildArtifacts: ['.'],
buildCacheEnabled: true,
@ -95,6 +99,7 @@ executeFreeleapsPipeline {
root: 'apps/payment',
language: 'python',
dependenciesManager: 'pip',
requirementsFile: 'requirements.txt',
buildAgentImage: 'python:3.10-slim-buster',
buildArtifacts: ['.'],
buildCacheEnabled: true,

View File

@ -8,7 +8,7 @@ central-storage:
registry: docker.io
repository: null
name: central_storage
tag: snapshot-da584b8
tag: 0.0.0
imagePullPolicy: IfNotPresent
ports:
- name: http

View File

@ -8,7 +8,7 @@ content:
registry: docker.io
repository: null
name: content
tag: snapshot-da584b8
tag: 0.0.0
imagePullPolicy: IfNotPresent
ports:
- name: http

View File

@ -8,7 +8,7 @@ notification:
registry: docker.io
repository: null
name: notification
tag: snapshot-da584b8
tag: 0.0.0
imagePullPolicy: IfNotPresent
ports:
- name: http

View File

@ -27,7 +27,24 @@ payment:
type: ClusterIP
port: 8006
targetPort: 8006
ingresses: {}
ingresses:
- name: payment-ingress
host: alpha.payment.freeleaps.mathmast.com
class: nginx
rules:
- path: /*
pathType: ImplementationSpecific
backend:
service:
name: payment-service
port:
number: 8006
tls:
exists: false
issuerRef:
name: mathmast-dot-com
kind: ClusterIssuer
name: alpha.payment.freeleaps.mathmast.com-cert
configs:
tz: America/Settle
appName: payment