Skip to content

Commit 339c429

Browse files
committed
Merge branch 'release/1.2'
2 parents 11da3a5 + 4189f4e commit 339c429

File tree

5 files changed

+74
-17
lines changed

5 files changed

+74
-17
lines changed

.gitlab-ci.yml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
image: docker:git
2-
31
stages:
4-
- build
5-
6-
variables:
7-
IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
8-
DOCKER_DRIVER: overlay
2+
- deploy
93

10-
Build Image:
11-
stage: build
4+
deploy-dists:
5+
stage: deploy
6+
image: docker:git
127
services:
138
- docker:dind
149
before_script:
15-
- docker info
16-
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
10+
- docker info
11+
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
12+
- apk add make
13+
- chmod +x ./ci/*
1714
script:
18-
- docker build --build-arg DEBUG=false -t $IMAGE_NAME .
19-
- docker push $IMAGE_NAME
15+
- ./ci/build.sh
16+
after_script:
17+
- ./ci/test.sh
18+
- ./ci/deploy.sh
2019
only:
21-
- master
22-
- tags
20+
- /^v[0-9]+[\.0-9]*[\.0-9]*$/

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ define check_distro_existence
2323
fi
2424

2525
$(eval DISTRO:=$(shell cat "./dists/$(DISTRO)/$(BASE_IMAGE_FILE)"))
26-
@echo $(DISTRO)
2726
endef
2827

2928
help:
@@ -32,7 +31,7 @@ help:
3231
@echo ' / __ / __ \/ ___/ //_/ _ \/ ___/ / ___/ / / / __ `__ \/ /_/ __ \/ __ \/ / / / '
3332
@echo ' / /_/ / /_/ / /__/ ,< / __/ / (__ ) /_/ / / / / / / __/ /_/ / / / / /_/ / '
3433
@echo ' \__,_/\____/\___/_/|_|\___/_/ /____/\__, /_/ /_/ /_/_/ \____/_/ /_/\__, / '
35-
@echo ' /____/ /____/ v1'
34+
@echo ' /____/ /____/ v1.2'
3635
@echo ''
3736
@echo "build REGISTRY_NAME= DISTRO="
3837
@echo " Create docker image from specific distro."

ci/build.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env sh
2+
3+
echo "[INFO]: Build all dists."
4+
echo "[INFO]: Working on \"${CI_REGISTRY_IMAGE}\" with ref name \"${CI_COMMIT_REF_NAME}\""
5+
6+
for DIST in ./dists/*; do
7+
[ -d "${DIST}" ] || continue
8+
DIST="$(basename "${DIST}")"
9+
BASE_IMAGE=`cat ./dists/${DIST}/base_image`
10+
docker pull ${BASE_IMAGE}
11+
if [ "$?" -eq "0" ]; then
12+
echo "[OK]: Base image pulled successfully."
13+
docker images
14+
else
15+
echo "[ERROR]: Couldn't pull base image."
16+
docker images
17+
exit 1
18+
fi
19+
20+
make build REGISTRY_NAME=$CI_REGISTRY_IMAGE DISTRO=${DIST} VERSION=${CI_COMMIT_REF_NAME}-${DIST}
21+
done

ci/deploy.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env sh
2+
3+
echo "[INFO]: Deploy all dists."
4+
echo "[INFO]: Working on \"${CI_REGISTRY_IMAGE}\" with ref name \"${CI_COMMIT_REF_NAME}\""
5+
6+
for DIST in ./dists/*; do
7+
[ -d "${DIST}" ] || continue
8+
DIST="$(basename "${DIST}")"
9+
make release REGISTRY_NAME=$CI_REGISTRY_IMAGE VERSION=${CI_COMMIT_REF_NAME}-${DIST}
10+
done

ci/test.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env sh
2+
3+
echo "[INFO]: Test all dists."
4+
echo "[INFO]: Working on \"${CI_REGISTRY_IMAGE}\" with ref name \"${CI_COMMIT_REF_NAME}\""
5+
6+
for DIST in ./dists/*; do
7+
[ -d "${DIST}" ] || continue
8+
DIST="$(basename "${DIST}")"
9+
IMAGE_NAME=${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}-${DIST}
10+
IMAGE_ID=`docker images -q ${IMAGE_NAME}`
11+
if [[ ! -z ${IMAGE_ID} ]]; then
12+
echo "[OK]: The image (${IMAGE_NAME}) was found successfully."
13+
docker images
14+
docker run -d --name ${DIST} ${IMAGE_NAME}
15+
IMAGE_STATUS=`docker ps -aq -f status=exited -f name=${DIST}`
16+
if [[ -z ${IMAGE_STATUS} ]]; then
17+
echo "[OK]: The image (${IMAGE_NAME}) has been running since a moment ago."
18+
docker ps -f name=${DIST}
19+
else
20+
echo "[ERROR]: The image (${IMAGE_NAME}) doesn't running."
21+
docker ps -f name=${DIST}
22+
exit 1
23+
fi
24+
else
25+
echo "[ERROR]: The image (${IMAGE_NAME}) doesn't exist."
26+
docker images
27+
exit 1
28+
fi
29+
done

0 commit comments

Comments
 (0)