Test a new build script to fix cross-architecture tagging

This commit is contained in:
Salt 2021-05-01 15:33:07 -05:00
parent 6c685db1b5
commit a1963a10ae

View File

@ -10,7 +10,6 @@ variables:
stages:
- build
# - test
- push
services:
- docker:dind
before_script:
@ -32,48 +31,24 @@ Build:
--platform linux/amd64,linux/arm64
--cache-from $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest
--tag $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
--tag $CI_HUB_USERNAME/$CI_PROJECT_NAME:bleeding
--push
.
- docker images
# TEST
# TODO: Fix this
#Test_HTTP_200:
# stage: test
# script:
# - apk add curl
# - docker run -d -p 8889:80 $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
# - sleep 10
# - docker ps
# - netstat -tulpn
# - curl localhost:8889 | grep -ie '200 OK'
# - docker kill $(docker ps -q)
# PUSH
Push_When_Tag:
stage: push
Build_Tag:
stage: build
only:
- tags
script:
- docker pull $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
- docker pull $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest || true
- docker buildx create --use
- >
docker tag
$CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
$CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_REF_NAME
- >
docker tag
$CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
$CI_HUB_USERNAME/$CI_PROJECT_NAME:latest
docker buildx build
--pull
--platform linux/amd64,linux/arm64
--cache-from $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest
--tag $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_REF_NAME
--tag $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest
--push
.
- docker images
- docker push $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_REF_NAME
- docker push $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest
Push_Bleeding:
stage: push
script:
- docker pull $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
- >
docker tag
$CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
$CI_HUB_USERNAME/$CI_PROJECT_NAME:bleeding
- docker images
- docker push $CI_HUB_USERNAME/$CI_PROJECT_NAME:bleeding