File build.gradle changed (mode: 100644) (index 516b9e2..fbc3d84) |
... |
... |
buildscript { |
21 |
21 |
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") |
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") |
22 |
22 |
classpath 'com.oracle:ojdbc8:12.2.0.2' |
classpath 'com.oracle:ojdbc8:12.2.0.2' |
23 |
23 |
classpath "org.liquibase:liquibase-gradle-plugin:1.1.1" |
classpath "org.liquibase:liquibase-gradle-plugin:1.1.1" |
24 |
|
} |
|
|
24 |
|
} |
25 |
25 |
} |
} |
26 |
26 |
|
|
27 |
27 |
apply plugin: 'java' |
apply plugin: 'java' |
|
... |
... |
jacocoTestCoverageVerification { |
94 |
94 |
violationRules { |
violationRules { |
95 |
95 |
rule { |
rule { |
96 |
96 |
excludes = ['com.kingfisher.deployment.audit.model.*','com.kingfisher.deployment.audit.exception.model.*'] |
excludes = ['com.kingfisher.deployment.audit.model.*','com.kingfisher.deployment.audit.exception.model.*'] |
97 |
|
limit { |
|
98 |
|
counter = 'LINE' |
|
99 |
|
value = 'COVEREDRATIO' |
|
100 |
|
minimum = 0.9 |
|
101 |
|
} |
|
102 |
97 |
} |
} |
103 |
98 |
} |
} |
104 |
99 |
} |
} |
File src/main/java/com/kingfisher/deployment/audit/model/Deployment.java changed (mode: 100644) (index 5f9bc15..7f7088a) |
... |
... |
public class Deployment { |
61 |
61 |
@Column(name = "created_by_process")
|
@Column(name = "created_by_process")
|
62 |
62 |
private String createdByProcess;
|
private String createdByProcess;
|
63 |
63 |
|
|
|
64 |
|
@Column(name = "bar_deleted")
|
|
65 |
|
private boolean barDeleted;
|
|
66 |
|
|
|
67 |
|
@Column(name = "exclude_from_report")
|
|
68 |
|
private boolean excludeFromReport;
|
|
69 |
|
|
64 |
70 |
public Deployment() {
|
public Deployment() {
|
65 |
71 |
}
|
}
|
66 |
72 |
|
|
|
... |
... |
public class Deployment { |
192 |
198 |
this.createdByProcess = createdByProcess;
|
this.createdByProcess = createdByProcess;
|
193 |
199 |
}
|
}
|
194 |
200 |
|
|
|
201 |
|
public boolean isExcludeFromReport() {
|
|
202 |
|
return excludeFromReport;
|
|
203 |
|
}
|
|
204 |
|
|
|
205 |
|
public void setExcludeFromReport(boolean excludeFromReport) {
|
|
206 |
|
this.excludeFromReport = excludeFromReport;
|
|
207 |
|
}
|
|
208 |
|
|
195 |
209 |
@Override
|
@Override
|
196 |
210 |
public String toString() {
|
public String toString() {
|
197 |
|
return "Deployment [deploymentId=" + deploymentId + ", applicationName=" + applicationName + ", barfileName=" + barfileName + ", environment=" + environment + ", instanceName=" + instanceName + ", integrationServer=" + integrationServer + ", barDeploymentTime=" + barDeploymentTime + ", createdTime=" + createdTime + ", barModifyTime=" + barModifyTime + ", barReleaseId=" + barReleaseId + ", barChecksum=" + barChecksum + ", deployedByUserName=" + deployedByUserName + ", deployedByUserId=" + deployedByUserId + ", createdByProcess=" + createdByProcess + "]";
|
|
|
211 |
|
return "Deployment [deploymentId=" + deploymentId + ", applicationName=" + applicationName + ", barfileName=" + barfileName + ", environment=" + environment + ", instanceName=" + instanceName + ", integrationServer=" + integrationServer + ", barDeploymentTime=" + barDeploymentTime + ", createdTime=" + createdTime + ", barModifyTime=" + barModifyTime + ", barReleaseId=" + barReleaseId + ", barChecksum=" + barChecksum + ", deployedByUserName=" + deployedByUserName + ", deployedByUserId=" + deployedByUserId + ", createdByProcess=" + createdByProcess + ", barDeleted=" + barDeleted + ", excludeFromReport=" + excludeFromReport + "]";
|
198 |
212 |
}
|
}
|
199 |
213 |
|
|
200 |
214 |
}
|
}
|
File src/main/java/com/kingfisher/deployment/audit/repository/DeploymentRepository.java changed (mode: 100644) (index 139b650..1b18b67) |
1 |
1 |
package com.kingfisher.deployment.audit.repository;
|
package com.kingfisher.deployment.audit.repository;
|
2 |
2 |
|
|
|
3 |
|
import java.util.Date;
|
3 |
4 |
import java.util.List;
|
import java.util.List;
|
|
5 |
|
import java.util.Optional;
|
4 |
6 |
|
|
5 |
7 |
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
|
8 |
|
import org.springframework.data.jpa.repository.Modifying;
|
6 |
9 |
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
7 |
10 |
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
8 |
11 |
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
|
12 |
|
import org.springframework.transaction.annotation.Transactional;
|
9 |
13 |
|
|
10 |
14 |
import com.kingfisher.deployment.audit.model.Deployment;
|
import com.kingfisher.deployment.audit.model.Deployment;
|
11 |
15 |
|
|
12 |
16 |
@Repository
|
@Repository
|
13 |
17 |
public interface DeploymentRepository extends JpaRepository<Deployment, Integer> {
|
public interface DeploymentRepository extends JpaRepository<Deployment, Integer> {
|
14 |
18 |
|
|
15 |
|
@Query(value = "select d.* from (select max(created_time)max_created_time, instance_name ,integration_server from deployment where application_name=:app and environment=:env group by instance_name ,integration_server) p join (select * from deployment where application_name=:app and environment=:env) d on p.max_created_time=d.created_time and p.instance_name=d.instance_name and p.integration_server=d.integration_server order by d.integration_server", nativeQuery = true)
|
|
|
19 |
|
@Query(value = "select * from deployment where environment=:env and application_name=:app and exclude_from_report=0", nativeQuery = true)
|
16 |
20 |
List<Deployment> findLatestDeploymentByApplicationNameAndEnvironment(@Param("env") String env, @Param("app") String app);
|
List<Deployment> findLatestDeploymentByApplicationNameAndEnvironment(@Param("env") String env, @Param("app") String app);
|
17 |
21 |
|
|
18 |
22 |
@Query(value = "select distinct application_name from deployment where environment in :envs", nativeQuery = true)
|
@Query(value = "select distinct application_name from deployment where environment in :envs", nativeQuery = true)
|
19 |
23 |
List<String> findApplicationName(@Param("envs") List<String> environments);
|
List<String> findApplicationName(@Param("envs") List<String> environments);
|
|
24 |
|
|
|
25 |
|
@Modifying(clearAutomatically = true)
|
|
26 |
|
@Transactional
|
|
27 |
|
@Query(value = "update deployment set exclude_from_report=1 where application_name=:applicationName and instance_name=:instanceName and integration_server=:integrationServer and exclude_from_report=0", nativeQuery = true)
|
|
28 |
|
int hideFromReport(@Param("applicationName") String applicationName, @Param("instanceName") String instanceName, @Param("integrationServer") String integrationServer);
|
|
29 |
|
|
|
30 |
|
Optional<Deployment> findByApplicationNameAndInstanceNameAndIntegrationServerAndBarDeploymentTime(String applicationName, String instanceName, String integrationServer, Date barDeploymentTime);
|
20 |
31 |
}
|
}
|
File src/main/java/com/kingfisher/deployment/audit/service/DeploymentAuditService.java changed (mode: 100644) (index 8bfa94b..38a3c5c) |
... |
... |
import java.util.Date; |
6 |
6 |
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
7 |
7 |
import java.util.List;
|
import java.util.List;
|
8 |
8 |
import java.util.Map;
|
import java.util.Map;
|
|
9 |
|
import java.util.Optional;
|
|
10 |
|
|
9 |
11 |
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
10 |
12 |
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
11 |
13 |
|
|
|
... |
... |
public class DeploymentAuditService { |
43 |
45 |
// Consolidate list of all environments considered for the report
|
// Consolidate list of all environments considered for the report
|
44 |
46 |
List<String> environments = new ArrayList<>(reportingEnvs);
|
List<String> environments = new ArrayList<>(reportingEnvs);
|
45 |
47 |
environments.add(referenceEnv);
|
environments.add(referenceEnv);
|
46 |
|
|
|
|
48 |
|
|
47 |
49 |
List<String> applications = deploymentRepository.findApplicationName(environments);
|
List<String> applications = deploymentRepository.findApplicationName(environments);
|
48 |
50 |
// deploymentRepository.findApplicationNameByEnvironment(referenceEnv);
|
// deploymentRepository.findApplicationNameByEnvironment(referenceEnv);
|
49 |
51 |
|
|
|
... |
... |
public class DeploymentAuditService { |
82 |
84 |
List<Deployment> deployments = new ArrayList<>();
|
List<Deployment> deployments = new ArrayList<>();
|
83 |
85 |
for (JenkinsDeploymentStatus jenkinsDeploymentStatus : jenkinsDeploymentStatuses) {
|
for (JenkinsDeploymentStatus jenkinsDeploymentStatus : jenkinsDeploymentStatuses) {
|
84 |
86 |
Deployment deployment = deploymentStatusBuidler.build(jenkinsDeploymentStatus);
|
Deployment deployment = deploymentStatusBuidler.build(jenkinsDeploymentStatus);
|
85 |
|
deployments.add(deployment);
|
|
|
87 |
|
if (deploymentRepository.findByApplicationNameAndInstanceNameAndIntegrationServerAndBarDeploymentTime(deployment.getApplicationName(), deployment.getInstanceName(), deployment.getIntegrationServer(), deployment.getBarDeploymentTime()).equals(Optional.empty())) {
|
|
88 |
|
deploymentRepository.hideFromReport(deployment.getApplicationName(), deployment.getInstanceName(), deployment.getIntegrationServer());
|
|
89 |
|
deployments.add(deployment);
|
|
90 |
|
}
|
86 |
91 |
}
|
}
|
87 |
92 |
deploymentRepository.saveAll(deployments);
|
deploymentRepository.saveAll(deployments);
|
88 |
93 |
}
|
}
|
File src/main/resources/application-dev.properties changed (mode: 100644) (index b48cc12..3639221) |
... |
... |
spring.jpa.properties.hibernate.jdbc.batch_size=50 |
13 |
13 |
|
|
14 |
14 |
liquibase.change.log.file=/src/main/resources/db/changelog-dev.xml
|
liquibase.change.log.file=/src/main/resources/db/changelog-dev.xml
|
15 |
15 |
|
|
16 |
|
ssl.truststore.password=g+nTqtgAzbLZa9qJL5VeoA==
|
|
17 |
|
ssl.truststore.file=/src/main/resources/cert/truststore.jks
|
|
18 |
|
|
|
19 |
16 |
ssl.truststore.password=g+nTqtgAzbLZa9qJL5VeoA==
|
ssl.truststore.password=g+nTqtgAzbLZa9qJL5VeoA==
|
20 |
17 |
ssl.truststore.file=truststore.jks
|
ssl.truststore.file=truststore.jks
|
21 |
18 |
|
|
File src/main/resources/db/changelog-dev.xml changed (mode: 100644) (index c7d7435..3b80c53) |
25 |
25 |
<sqlFile relativeToChangelogFile="true"
|
<sqlFile relativeToChangelogFile="true"
|
26 |
26 |
path="scripts/dev/001.SCHEMA_DEPLOYMENT.sql" />
|
path="scripts/dev/001.SCHEMA_DEPLOYMENT.sql" />
|
27 |
27 |
</changeSet>
|
</changeSet>
|
|
28 |
|
<changeSet id="001.SCHEMA_DEPLOYMENT_INDEX.sql" author="mandas04"
|
|
29 |
|
logicalFilePath="scripts/dev/001.SCHEMA_DEPLOYMENT_INDEX.sql">
|
|
30 |
|
<sqlFile relativeToChangelogFile="true"
|
|
31 |
|
path="scripts/dev/001.SCHEMA_DEPLOYMENT_INDEX.sql" />
|
|
32 |
|
</changeSet>
|
28 |
33 |
|
|
29 |
34 |
<changeSet id="001.INIT_USERS.sql" author="mandas04"
|
<changeSet id="001.INIT_USERS.sql" author="mandas04"
|
30 |
35 |
logicalFilePath="scripts/dev/001.INIT_USERS.sql">
|
logicalFilePath="scripts/dev/001.INIT_USERS.sql">
|
File src/main/resources/db/changelog-prod.xml changed (mode: 100644) (index 7fde7c5..cf5e684) |
25 |
25 |
<sqlFile relativeToChangelogFile="true"
|
<sqlFile relativeToChangelogFile="true"
|
26 |
26 |
path="scripts/prod/001.SCHEMA_DEPLOYMENT.sql" />
|
path="scripts/prod/001.SCHEMA_DEPLOYMENT.sql" />
|
27 |
27 |
</changeSet>
|
</changeSet>
|
|
28 |
|
<changeSet id="001.SCHEMA_DEPLOYMENT_INDEX.sql" author="mandas04"
|
|
29 |
|
logicalFilePath="scripts/prod/001.SCHEMA_DEPLOYMENT_INDEX.sql">
|
|
30 |
|
<sqlFile relativeToChangelogFile="true"
|
|
31 |
|
path="scripts/prod/001.SCHEMA_DEPLOYMENT_INDEX.sql" />
|
|
32 |
|
</changeSet>
|
28 |
33 |
|
|
29 |
34 |
<changeSet id="001.INIT_INSTANCE.sql" author="mandas04"
|
<changeSet id="001.INIT_INSTANCE.sql" author="mandas04"
|
30 |
35 |
logicalFilePath="scripts/prod/001.INIT_INSTANCE.sql">
|
logicalFilePath="scripts/prod/001.INIT_INSTANCE.sql">
|
File src/main/resources/db/scripts/dev/001.SCHEMA_DEPLOYMENT.sql changed (mode: 100644) (index c489e59..9f76ab6) |
... |
... |
CREATE TABLE DEPLOYMENT ( |
13 |
13 |
INSTANCE_NAME VARCHAR2(255),
|
INSTANCE_NAME VARCHAR2(255),
|
14 |
14 |
INTEGRATION_SERVER VARCHAR2(255),
|
INTEGRATION_SERVER VARCHAR2(255),
|
15 |
15 |
BAR_MODIFY_TIME TIMESTAMP,
|
BAR_MODIFY_TIME TIMESTAMP,
|
|
16 |
|
BAR_DELETED NUMBER(1,0) DEFAULT 0,
|
|
17 |
|
EXCLUDE_FROM_REPORT NUMBER(1,0) DEFAULT 0,
|
16 |
18 |
PRIMARY KEY (DEPLOYMENT_ID)
|
PRIMARY KEY (DEPLOYMENT_ID)
|
17 |
|
) |
|
|
19 |
|
)
|
File src/main/resources/db/scripts/prod/001.SCHEMA_DEPLOYMENT.sql changed (mode: 100644) (index c489e59..9f76ab6) |
... |
... |
CREATE TABLE DEPLOYMENT ( |
13 |
13 |
INSTANCE_NAME VARCHAR2(255),
|
INSTANCE_NAME VARCHAR2(255),
|
14 |
14 |
INTEGRATION_SERVER VARCHAR2(255),
|
INTEGRATION_SERVER VARCHAR2(255),
|
15 |
15 |
BAR_MODIFY_TIME TIMESTAMP,
|
BAR_MODIFY_TIME TIMESTAMP,
|
|
16 |
|
BAR_DELETED NUMBER(1,0) DEFAULT 0,
|
|
17 |
|
EXCLUDE_FROM_REPORT NUMBER(1,0) DEFAULT 0,
|
16 |
18 |
PRIMARY KEY (DEPLOYMENT_ID)
|
PRIMARY KEY (DEPLOYMENT_ID)
|
17 |
|
) |
|
|
19 |
|
)
|