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