ci: reuse active app list in woodpecker
This commit is contained in:
@@ -15,7 +15,8 @@ class WoodpeckerPipelineTest {
|
||||
String pipeline = Files.readString(repositoryRoot().resolve("woodpecker.yml"));
|
||||
|
||||
assertThat(pipeline)
|
||||
.contains("ACTIVE_APPS=\"gb32960-ingest-app jt808-ingest-app yutong-mqtt-app vehicle-history-app vehicle-analytics-app\"")
|
||||
.contains("ACTIVE_APPS: &active_apps \"gb32960-ingest-app jt808-ingest-app yutong-mqtt-app vehicle-history-app vehicle-analytics-app\"")
|
||||
.contains("ACTIVE_APPS: *active_apps")
|
||||
.contains("- name: docker-build-apps")
|
||||
.doesNotContain("xinda-push-app")
|
||||
.doesNotContain("KAFKA_TOPIC_XINDA_PUSH");
|
||||
@@ -23,6 +24,18 @@ class WoodpeckerPipelineTest {
|
||||
assertThat(countOccurrences(pipeline, "- name: docker-build-")).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
void activeAppListIsDefinedOnceAndReusedAcrossPipelineSteps() throws IOException {
|
||||
String pipeline = Files.readString(repositoryRoot().resolve("woodpecker.yml"));
|
||||
String activeApps = "gb32960-ingest-app jt808-ingest-app yutong-mqtt-app vehicle-history-app vehicle-analytics-app";
|
||||
|
||||
assertThat(countOccurrences(pipeline, activeApps)).isEqualTo(1);
|
||||
assertThat(pipeline)
|
||||
.contains("ACTIVE_APPS: &active_apps \"" + activeApps + "\"")
|
||||
.contains("ACTIVE_APPS: *active_apps")
|
||||
.doesNotContain("ACTIVE_APPS=\"" + activeApps + "\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
void dockerImageExposesOnlyCurrentProductionPorts() throws IOException {
|
||||
String dockerfile = Files.readString(repositoryRoot().resolve("Dockerfile"));
|
||||
|
||||
@@ -10,10 +10,11 @@ steps:
|
||||
- master
|
||||
- develop
|
||||
- main
|
||||
environment:
|
||||
ACTIVE_APPS: &active_apps "gb32960-ingest-app jt808-ingest-app yutong-mqtt-app vehicle-history-app vehicle-analytics-app"
|
||||
commands: |
|
||||
cd $CI_WORKSPACE
|
||||
|
||||
ACTIVE_APPS="gb32960-ingest-app jt808-ingest-app yutong-mqtt-app vehicle-history-app vehicle-analytics-app"
|
||||
ACTIVE_MODULES=""
|
||||
for APP_NAME in $ACTIVE_APPS; do
|
||||
if [ -z "$ACTIVE_MODULES" ]; then
|
||||
@@ -48,13 +49,13 @@ steps:
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
environment:
|
||||
ACTIVE_APPS: *active_apps
|
||||
ALIYUN_ACR_USERNAME:
|
||||
from_secret: aliyun_acr_username
|
||||
ALIYUN_ACR_PASSWORD:
|
||||
from_secret: aliyun_acr_password
|
||||
commands: |
|
||||
cd $CI_WORKSPACE
|
||||
ACTIVE_APPS="gb32960-ingest-app jt808-ingest-app yutong-mqtt-app vehicle-history-app vehicle-analytics-app"
|
||||
APP_VERSION=$(cat $CI_WORKSPACE/project_version.txt)
|
||||
REGISTRY=crpi-85r4m0ackrm3qpje.cn-shanghai.personal.cr.aliyuncs.com
|
||||
NAMESPACE=oneos
|
||||
|
||||
Reference in New Issue
Block a user