This repository has been archived by the owner on Aug 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
64 lines (49 loc) · 2.22 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env groovy
// Shared Jenkins library can be found at https://github.com/vikingco/shared-jenkins-logic
@Library("shared-jenkins-logic@master")
/*******************************/
/* Project specific settings */
/*******************************/
PROJECT_NAME = "pdf_gen_poc";
DOCKER_CONTAINER_NAME = PROJECT_NAME;
AWS_REPOSITORY_NAME = PROJECT_NAME;
HELM_CHART_NAME = PROJECT_NAME;
TEST_MAKE_COMMANDS = [
flake8: "test_flake8",
black: "test_black",
isort: "test_isort",
mypy: "test_mypy",
python: "test_python",
migrations: "test_makemigrations"
];
/*******************************/
/* Constants */
/*******************************/
SSH_CREDENTIALS_KEY = "jenkins2"; // Key in the Jenkins credentials store that points to the ssh file
ENVIRONMENTS = sharedEnvironments.getEnvironments();
// ENVIRONMENTS[0].deployOnlyFromMaster = false;
properties([
buildDiscarder(logRotator(daysToKeepStr: "5", numToKeepStr: "10", artifactNumToKeepStr: "1")),
]);
/*******************************/
/* Pipeline */
/*******************************/
node {
timestamps {
try {
gitCommit = sharedJenkinsLogic.clone();
testImage = sharedDockerImages.getDefaultTestImage(DOCKER_CONTAINER_NAME, gitCommit);
testImage.prebuildTargets = ["requirements_builder"];
deployImage = sharedDockerImages.getDefaultDeployImage(DOCKER_CONTAINER_NAME, gitCommit);
deployImage.prebuildTargets = ["requirements_builder"];
sharedJenkinsLogic.build(SSH_CREDENTIALS_KEY, [testImage, deployImage], false, AWS_REPOSITORY_NAME);
sharedJenkinsLogic.lint(ENVIRONMENTS, gitCommit, HELM_CHART_NAME, [deployImage]);
sharedJenkinsLogic.test(TEST_MAKE_COMMANDS, testImage);
def awsEnvironments = sharedJenkinsLogic.selectDeployEnvironments(ENVIRONMENTS);
sharedJenkinsLogic.publish(awsEnvironments, [deployImage], AWS_REPOSITORY_NAME, HELM_CHART_NAME, gitCommit);
sharedJenkinsLogic.generateDeployButtons(awsEnvironments, HELM_CHART_NAME, gitCommit, AWS_REPOSITORY_NAME, [deployImage]);
} finally {
sharedJenkinsLogic.cleanup([testImage, deployImage]);
}
}
}