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