[DO-1395] add_podtemplate (#50)
Co-authored-by: Rustam Tagaev <rustam.tagaev@avroid.tech> Reviewed-on: https://git.avroid.tech/DevOps/jenkins-shared-lib/pulls/50 Reviewed-by: Denis Patrakeev <denis.patrakeev@avroid.team> Co-authored-by: Rustam Tagaev <rustam.tagaev@avroid.team> Co-committed-by: Rustam Tagaev <rustam.tagaev@avroid.team>
This commit is contained in:
committed by
Denis Patrakeev
parent
79a8b725ce
commit
426b6beb9f
@@ -162,4 +162,25 @@ class Nexus implements Serializable {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Функция загружает артефакт в Npm-репозиторий Nexus
|
||||
@param repository String - Имя репозитория в Nexus.
|
||||
@param artifact String - Путь до артефакта.
|
||||
@param artifactName String - Имя артефакта которое будет отображаться в Nexus. (optional)
|
||||
*/
|
||||
public void uploadNpmArtifact(Map args = [:]) {
|
||||
String artifactName = args.artifactName ?: args.artifact.split('/').last()
|
||||
|
||||
script.httpRequest(
|
||||
url: "${host}/service/rest/v1/components?repository=${args.repository}",
|
||||
httpMode: 'POST',
|
||||
quiet: false,
|
||||
formData: [[contentType: 'APPLICATION_FORM_DATA',
|
||||
name: 'npm.asset',
|
||||
fileName: artifactName,
|
||||
uploadFile: args.artifact]],
|
||||
authentication: credentials
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -226,4 +226,38 @@ class PodTemplates implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public void nodejs(imageVersion='18.16-alpine3.18', body) {
|
||||
this.script.podTemplate(
|
||||
runAsUser: "0",
|
||||
imagePullSecrets: this.dockerCreds,
|
||||
containers: [
|
||||
this.script.containerTemplate(
|
||||
alwaysPullImage: true,
|
||||
name: 'nodejs',
|
||||
image: "${this.registry}/devops/node:${imageVersion}",
|
||||
envVars: [
|
||||
this.script.containerEnvVar(key: 'HOME', value: '/home/jenkins'),
|
||||
],
|
||||
ttyEnabled: true,
|
||||
command: "cat",
|
||||
resourceRequestCpu: '100m',
|
||||
resourceLimitCpu: '100m',
|
||||
resourceRequestMemory: '1024Mi',
|
||||
resourceLimitMemory: '1024Mi',
|
||||
workingDir: '/jenkins',
|
||||
),
|
||||
],
|
||||
instanceCap: 1,
|
||||
showRawYaml: false,
|
||||
volumes: [
|
||||
this.script.emptyDirVolume(memory: false, mountPath: '/tmp'),
|
||||
],
|
||||
workspaceVolume: this.script.emptyDirWorkspaceVolume(false),
|
||||
)
|
||||
|
||||
{
|
||||
body.call()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user