Commit e9adfb0b authored by Louis Gesbert's avatar Louis Gesbert
Browse files

Remove the explicit hack, move the docker hub code to ocaml-images-gen.yml

This reverts commit 5b1767f0.
parent 5171558c
# make-targets:
# stage: .pre
# image: alpine:3.11
# script:
# - apk add curl jq
# - curl https://api.github.com/repos/ocaml/ocaml/releases
# | jq -r 'map(.tag_name | split(".") | {"maj":.[0:2], "pat":.}) | group_by(.maj) | .[] | max | .pat | join(".")'
# | tail -n +3
# > versions
# - |
# { for v in $(cat versions); do
# echo "ocaml-image-$v:";
# echo " extends: .ocaml-image";
# echo " variables:";
# echo " OCAML_VERSION: $v";
# echo;
# done;
# echo "variables:"
# echo " LATEST_OCAML_VERSION: $(tail -n1 versions)";
# } > ocaml-images.yml
# artifacts:
# paths:
# - ocaml-images.yml
# build-images:
# stage: build
# variables:
# trigger:
# include:
# - local: ocaml-images-gen.yml
# - artifact: ocaml-images.yml
# job: make-targets
# strategy: depend
# only:
# - master
.ocaml-image:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
variables:
DOCKERHUB_IMAGE: ocamlpro/ocaml
make-targets:
stage: .pre
image: alpine:3.11
script:
- apk add curl jq
- curl https://api.github.com/repos/ocaml/ocaml/releases
| jq -r 'map(.tag_name | split(".") | {"maj":.[0:2], "pat":.}) | group_by(.maj) | .[] | max | .pat | join(".")'
| tail -n +3
> versions
- |
echo "{
\"auths\": {
\"$CI_REGISTRY\": {
\"username\":\"$CI_REGISTRY_USER\",
\"password\":\"$CI_REGISTRY_PASSWORD\"
},
\"https://index.docker.io/v1/\": {
\"auth\":\"$DOCKERHUB_AUTH\"
}
}}
" > /kaniko/.docker/config.json
- /kaniko/executor --cache=true
--context=$CI_PROJECT_DIR
--dockerfile=$CI_PROJECT_DIR/Dockerfile
--build-arg=OCAML_VERSION=$OCAML_VERSION
--build-arg=LAST_REPO_UPDATE=$(date +%s)
--destination=$CI_REGISTRY_IMAGE:${OCAML_VERSION}
--destination=$DOCKERHUB_IMAGE:${OCAML_VERSION}
--destination=$CI_REGISTRY_IMAGE:${OCAML_VERSION%.*}
--destination=$DOCKERHUB_IMAGE:${OCAML_VERSION%.*}
--destination=$CI_REGISTRY_IMAGE:${OCAML_VERSION%.*}-$(date +%F)
--destination=$DOCKERHUB_IMAGE:${OCAML_VERSION%.*}-$(date +%F)
$(if [ "$OCAML_VERSION" = "$LATEST_OCAML_VERSION" ]; then
echo "--destination=$CI_REGISTRY_IMAGE:latest";
echo "--destination=$DOCKERHUB_IMAGE:latest";
fi)
{ for v in $(cat versions); do
echo "ocaml-image-$v:";
echo " extends: .ocaml-image";
echo " variables:";
echo " OCAML_VERSION: $v";
echo;
done;
echo "variables:"
echo " LATEST_OCAML_VERSION: $(tail -n1 versions)";
} > ocaml-images.yml
artifacts:
paths:
- ocaml-images.yml
build-images:
stage: build
trigger:
include:
- local: ocaml-images-gen.yml
- artifact: ocaml-images.yml
job: make-targets
strategy: depend
only:
- master
ocaml-image-4.02.3:
extends: .ocaml-image
variables:
OCAML_VERSION: 4.02.3
ocaml-image-4.03.0:
extends: .ocaml-image
variables:
OCAML_VERSION: 4.03.0
ocaml-image-4.04.2:
extends: .ocaml-image
variables:
OCAML_VERSION: 4.04.2
ocaml-image-4.05.0:
extends: .ocaml-image
variables:
OCAML_VERSION: 4.05.0
ocaml-image-4.06.1:
extends: .ocaml-image
variables:
OCAML_VERSION: 4.06.1
ocaml-image-4.07.1:
extends: .ocaml-image
variables:
OCAML_VERSION: 4.07.1
ocaml-image-4.08.1:
extends: .ocaml-image
variables:
OCAML_VERSION: 4.08.1
ocaml-image-4.09.1:
extends: .ocaml-image
variables:
OCAML_VERSION: 4.09.1
ocaml-image-4.10.1:
extends: .ocaml-image
variables:
OCAML_VERSION: 4.10.1
ocaml-image-4.11.1:
extends: .ocaml-image
variables:
OCAML_VERSION: 4.11.1
variables:
LATEST_OCAML_VERSION: 4.11.1
......@@ -3,6 +3,8 @@
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
variables:
DOCKERHUB_IMAGE: ocamlpro/ocaml
script:
- |
echo "{
......@@ -10,18 +12,26 @@
\"$CI_REGISTRY\": {
\"username\":\"$CI_REGISTRY_USER\",
\"password\":\"$CI_REGISTRY_PASSWORD\"
}}}
" > /kaniko/.docker/config.json
},
\"https://index.docker.io/v1/\": {
\"auth\":\"$DOCKERHUB_AUTH\"
}
}
}" > /kaniko/.docker/config.json
- /kaniko/executor --cache=true
--context=$CI_PROJECT_DIR
--dockerfile=$CI_PROJECT_DIR/Dockerfile
--build-arg=OCAML_VERSION=$OCAML_VERSION
--build-arg=LAST_REPO_UPDATE=$(date +%s)
--destination=$CI_REGISTRY_IMAGE:${OCAML_VERSION}
--destination=$DOCKERHUB_IMAGE:${OCAML_VERSION}
--destination=$CI_REGISTRY_IMAGE:${OCAML_VERSION%.*}
--destination=$DOCKERHUB_IMAGE:${OCAML_VERSION%.*}
--destination=$CI_REGISTRY_IMAGE:${OCAML_VERSION%.*}-$(date +%F)
--destination=$DOCKERHUB_IMAGE:${OCAML_VERSION%.*}-$(date +%F)
$(if [ "$OCAML_VERSION" = "$LATEST_OCAML_VERSION" ]; then
echo "--destination=$CI_REGISTRY_IMAGE:latest";
echo "--destination=$DOCKERHUB_IMAGE:latest";
fi)
only:
- master
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