Commit 355bc272 authored by nanahira's avatar nanahira

rework ci

parent b537ff49
Pipeline #15917 canceled with stages
in 3 minutes and 56 seconds
stages: stages:
- build - build
- build2 - build2
- combine
- deploy - deploy
variables: variables:
GIT_DEPTH: "1" GIT_DEPTH: "1"
CONTAINER_TEST_IMAGE_FULL: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-full
CONTAINER_TEST_IMAGE_LITE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-lite
CONTAINER_TEST_IMAGE_X86_FULL: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-x86-full
CONTAINER_TEST_IMAGE_X86_LITE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-x86-lite
CONTAINER_TEST_IMAGE_ARM_FULL: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-arm-full
CONTAINER_TEST_IMAGE_ARM_LITE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-arm-lite
CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest
CONTAINER_RELEASE_IMAGE_FULL: $CI_REGISTRY_IMAGE:full
CONTAINER_RELEASE_IMAGE_LITE: $CI_REGISTRY_IMAGE:lite
build_lite_x86: .docker-op:
stage: build before_script:
tags:
- docker
script:
- TARGET_IMAGE=$CONTAINER_TEST_IMAGE_X86_LITE
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build --pull --no-cache -f ./Dockerfile.lite -t $TARGET_IMAGE .
- docker push $TARGET_IMAGE
build_lite_arm:
stage: build
tags:
- docker-arm
script:
- TARGET_IMAGE=$CONTAINER_TEST_IMAGE_ARM_LITE
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build --pull --no-cache -f ./Dockerfile.lite -t $TARGET_IMAGE .
- docker push $TARGET_IMAGE
build_full_x86: .docker-x86:
stage: build2 extends: .docker-op
tags: tags:
- docker - docker
script: variables:
- TARGET_IMAGE=$CONTAINER_TEST_IMAGE_X86_FULL ARCH: x86
- SOURCE_IMAGE=$CONTAINER_TEST_IMAGE_X86_LITE
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY .docker-arm:
- docker build --build-arg BASE_IMAGE=$SOURCE_IMAGE --pull --no-cache -t extends: .docker-op
$TARGET_IMAGE .
- docker push $TARGET_IMAGE
build_full_arm:
stage: build2
tags: tags:
- docker-arm - docker-arm
variables:
ARCH: arm
.build_lite:
stage: build
script: script:
- TARGET_IMAGE=$CONTAINER_TEST_IMAGE_ARM_FULL - docker build --pull --no-cache -f ./Dockerfile.lite -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$ARCH-lite .
- SOURCE_IMAGE=$CONTAINER_TEST_IMAGE_ARM_LITE - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$ARCH-lite
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build --build-arg BASE_IMAGE=$SOURCE_IMAGE --pull --no-cache -t build_lite_x86:
$TARGET_IMAGE . extends:
- docker push $TARGET_IMAGE - .docker-x86
combine_lite: - .build_lite
build_lite_arm:
extends:
- .docker-arm
- .build_lite
.build_full:
stage: build2 stage: build2
tags:
- docker
script: script:
- TARGET_IMAGE=$CONTAINER_TEST_IMAGE_LITE - docker build --build-arg $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$ARCH-lite--pull --no-cache -t
- SOURCE_IMAGE_2=$CONTAINER_TEST_IMAGE_ARM_LITE $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$ARCH-full .
- SOURCE_IMAGE_1=$CONTAINER_TEST_IMAGE_X86_LITE - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$ARCH-full
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $SOURCE_IMAGE_1 build_full_x86:
- docker pull $SOURCE_IMAGE_2 extends:
- docker manifest create $TARGET_IMAGE --amend $SOURCE_IMAGE_1 --amend - .docker-x86
$SOURCE_IMAGE_2 - .build_full
- docker manifest push $TARGET_IMAGE
build_full_arm:
combine_full: extends:
stage: combine - .docker-arm
tags: - .build_full
- docker
.deploy_image:
stage: deploy
extends: .docker-x86
script: script:
- TARGET_IMAGE=$CONTAINER_TEST_IMAGE_FULL - docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-x86-$DEPLOY_TYPE
- SOURCE_IMAGE_2=$CONTAINER_TEST_IMAGE_ARM_FULL - docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-arm-$DEPLOY_TYPE
- SOURCE_IMAGE_1=$CONTAINER_TEST_IMAGE_X86_FULL - docker manifest create $CI_REGISTRY_IMAGE:$DEPLOY_TAG $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-x86-$DEPLOY_TYPE $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-arm-$DEPLOY_TYPE
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker manifest push $CI_REGISTRY_IMAGE:$DEPLOY_TAG
- docker pull $SOURCE_IMAGE_1
- docker pull $SOURCE_IMAGE_2 deploy_lite:
- docker manifest create $TARGET_IMAGE --amend $SOURCE_IMAGE_1 --amend extends: .deploy_image
$SOURCE_IMAGE_2 variables:
- docker manifest push $TARGET_IMAGE DEPLOY_TYPE: lite
DEPLOY_TAG: $CI_COMMIT_REF_SLUG-lite
deploy_full:
extends: .deploy_image
variables:
DEPLOY_TYPE: full
DEPLOY_TAG: $CI_COMMIT_REF_SLUG-full
deploy_branch:
extends: .deploy_image
variables:
DEPLOY_TYPE: full
DEPLOY_TAG: $CI_COMMIT_REF_SLUG
deploy_latest_lite:
extends: .deploy_image
variables:
DEPLOY_TYPE: lite
DEPLOY_TAG: lite
only:
- master
deploy_latest_full:
extends: .deploy_image
variables:
DEPLOY_TYPE: full
DEPLOY_TAG: full
only:
- master
deploy_latest:
extends: .deploy_image
variables:
DEPLOY_TYPE: full
DEPLOY_TAG: latest
only:
- master
upload_stuff_to_minio: upload_stuff_to_minio:
stage: deploy stage: deploy
tags: tags:
- linux - linux
image: $CONTAINER_TEST_IMAGE_FULL image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-x86-full
script: script:
- apt update ; apt -y install python3-pip - apt update ; apt -y install python3-pip
- pip3 install -U -i https://mirrors.aliyun.com/pypi/simple/ awscli - pip3 install -U -i https://mirrors.aliyun.com/pypi/simple/ awscli
...@@ -102,62 +123,3 @@ upload_stuff_to_minio: ...@@ -102,62 +123,3 @@ upload_stuff_to_minio:
/dist/ygopro-server.tar.gz s3://mycard/srvpro/ygopro-server.tar.gz /dist/ygopro-server.tar.gz s3://mycard/srvpro/ygopro-server.tar.gz
only: only:
- master - master
deploy_latest_full:
stage: deploy
tags:
- docker
script:
- TARGET_IMAGE_2=$CONTAINER_RELEASE_IMAGE
- TARGET_IMAGE=$CONTAINER_RELEASE_IMAGE_FULL
- SOURCE_IMAGE=$CONTAINER_TEST_IMAGE_FULL
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $SOURCE_IMAGE
- docker tag $SOURCE_IMAGE $TARGET_IMAGE
- docker push $TARGET_IMAGE
- docker tag $SOURCE_IMAGE $TARGET_IMAGE_2
- docker push $TARGET_IMAGE_2
only:
- master
deploy_latest_lite:
stage: deploy
tags:
- docker
script:
- TARGET_IMAGE=$CONTAINER_RELEASE_IMAGE_LITE
- SOURCE_IMAGE=$CONTAINER_TEST_IMAGE_LITE
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $SOURCE_IMAGE
- docker tag $SOURCE_IMAGE $TARGET_IMAGE
- docker push $TARGET_IMAGE
only:
- master
deploy_tag_full:
stage: deploy
tags:
- docker
script:
- TARGET_IMAGE_2=$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
- TARGET_IMAGE=$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG-full
- SOURCE_IMAGE=$CONTAINER_TEST_IMAGE_FULL
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $SOURCE_IMAGE
- docker tag $SOURCE_IMAGE $TARGET_IMAGE
- docker push $TARGET_IMAGE
- docker tag $SOURCE_IMAGE $TARGET_IMAGE_2
- docker push $TARGET_IMAGE_2
only:
- tags
deploy_tag_lite:
stage: deploy
tags:
- docker
script:
- TARGET_IMAGE=$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG-lite
- SOURCE_IMAGE=$CONTAINER_TEST_IMAGE_LITE
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $SOURCE_IMAGE
- docker tag $SOURCE_IMAGE $TARGET_IMAGE
- docker push $TARGET_IMAGE
only:
- tags
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment