ci: parameterize docker image prefix
This commit is contained in:
@@ -45,6 +45,18 @@ class WoodpeckerPipelineTest {
|
|||||||
.doesNotContain("-DskipTests");
|
.doesNotContain("-DskipTests");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void dockerPublishUsesOverridableImagePrefix() throws IOException {
|
||||||
|
String pipeline = Files.readString(repositoryRoot().resolve("woodpecker.yml"));
|
||||||
|
|
||||||
|
assertThat(pipeline)
|
||||||
|
.contains("REGISTRY=${LINGNIU_IMAGE_REGISTRY:-crpi-85r4m0ackrm3qpje.cn-shanghai.personal.cr.aliyuncs.com}")
|
||||||
|
.contains("NAMESPACE=${LINGNIU_IMAGE_NAMESPACE:-oneos}")
|
||||||
|
.contains("IMAGE=$REGISTRY/$NAMESPACE/$APP_NAME:$APP_VERSION")
|
||||||
|
.doesNotContain("\n REGISTRY=crpi-85r4m0ackrm3qpje.cn-shanghai.personal.cr.aliyuncs.com")
|
||||||
|
.doesNotContain("\n NAMESPACE=oneos");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void dockerImageExposesOnlyCurrentProductionPorts() throws IOException {
|
void dockerImageExposesOnlyCurrentProductionPorts() throws IOException {
|
||||||
String dockerfile = Files.readString(repositoryRoot().resolve("Dockerfile"));
|
String dockerfile = Files.readString(repositoryRoot().resolve("Dockerfile"));
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ steps:
|
|||||||
commands: |
|
commands: |
|
||||||
cd $CI_WORKSPACE
|
cd $CI_WORKSPACE
|
||||||
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=${LINGNIU_IMAGE_REGISTRY:-crpi-85r4m0ackrm3qpje.cn-shanghai.personal.cr.aliyuncs.com}
|
||||||
NAMESPACE=oneos
|
NAMESPACE=${LINGNIU_IMAGE_NAMESPACE:-oneos}
|
||||||
|
|
||||||
printf '%s' "$ALIYUN_ACR_PASSWORD" | docker login \
|
printf '%s' "$ALIYUN_ACR_PASSWORD" | docker login \
|
||||||
--username "$ALIYUN_ACR_USERNAME" \
|
--username "$ALIYUN_ACR_USERNAME" \
|
||||||
|
|||||||
Reference in New Issue
Block a user