diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2f0f6957f8249988669c950785b912eb0e6304ac..99e8765f51a41ffc007a8f7c06e8ed2ca03f2df6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,279 +1,131 @@ -.functions: &functions | - function get_tag_for { - local container_name=$1 - local container_tag - if [[ ${container_name} =~ "kubernetes" ]] ; then - container_tag=$KUBE_TAG - elif [ ${container_name} == "docker-centos" ] ; then - container_tag=$DOCKER_TAG - else - echo "Container: ${container_name} is not defined." - exit 1 - fi - echo ${container_tag}-${RELEASE} - } - - function build_base_images { - # keep kubernetes-node and kubernetes-master images by running a container, - # so that the cleanup script doesn't remove them - - docker pull registry.fedoraproject.org/fedora:rawhide - docker run -d registry.fedoraproject.org/fedora:rawhide sleep 3600 - - docker build --rm -t kubernetes-node:rawhide kubernetes-node/ - docker run -d kubernetes-node:rawhide sleep 3600 - - docker build --rm -t kubernetes-master:rawhide kubernetes-master/ - docker run -d kubernetes-master:rawhide sleep 3600 - } - - function check_if_image_exists { - # check in the container tag already exists. - set +e - docker pull gitlab-registry.cern.ch/"$CI_PROJECT_NAMESPACE"/"$CI_PROJECT_NAME"/"$CONTAINER":"${TAG}" - if [ $? -eq 0 ] ; then - echo "Please update the cern-release file adding a new tag for""${CONTAINER}"" or release." - exit 1 - fi - set -e - } - stages: - - deploy - image_sync -before_script: - - export CONTAINERS="kubernetes-apiserver kubernetes-scheduler kubernetes-controller-manager kubernetes-kubelet kubernetes-proxy" - - export IMAGE_PREFIX=gitlab-registry.cern.ch/"$CI_PROJECT_NAMESPACE"/"$CI_PROJECT_NAME"/ - - source cern-release - - set -e - - *functions -deploy branch: - stage: deploy - image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide - script: - - curl -o kubernetes-apiserver/kubectl -O https://storage.googleapis.com/kubernetes-release/release/${KUBE_TAG}/bin/linux/amd64/kubectl - - for CONTAINER in $CONTAINERS ; do - - TAG=$(get_tag_for ${CONTAINER}) - - buildah --storage-driver vfs bud --isolation chroot -t "${IMAGE_PREFIX}""${CONTAINER}":"$CI_COMMIT_SHA" "${CONTAINER}" - - buildah --storage-driver vfs push --creds gitlab-ci-token:$CI_BUILD_TOKEN "${IMAGE_PREFIX}""${CONTAINER}":"$CI_COMMIT_SHA" docker://"${IMAGE_PREFIX}""${CONTAINER}":"$CI_COMMIT_SHA" - - buildah --storage-driver vfs rmi "${IMAGE_PREFIX}""${CONTAINER}":"$CI_COMMIT_SHA" - - done - except: - - tags - - cern-master - - cern-qa - - schedules - - /^cron.*$/ - -# The token is required to be written in a file and not evaluate the curl request since it containes -# the protected password variable. -deploy tag: - stage: deploy - image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide - script: - - if [ ${CI_COMMIT_TAG} -ne ${RELEASE} ] ; then - - echo "Release ${RELEASE} in cern-release file doesn't match CI_COMMIT_TAG ${CI_COMMIT_TAG} ." - - exit 1 - - fi - - for CONTAINER in $CONTAINERS ; do - - TAG=$(get_tag_for ${CONTAINER}) - - buildah --storage-driver vfs pull "${IMAGE_PREFIX}${CONTAINER}:${CI_COMMIT_SHA}" - - DIGEST=$(skopeo inspect "docker://${IMAGE_PREFIX}${CONTAINER}:${CI_COMMIT_SHA}" | jq .Digest -r | grep -oE '[0-9a-f]{64}') - - >- - curl - --silent - --user svcbuild:${SVCBUILD_PASSWORD} - -H "Accept: application/json" - -d account= - -d client_id=docker - -d offline_token=true - -d service=container_registry - -d scope=repository:${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}/${CONTAINER}:* - -G https://gitlab.cern.ch/jwt/auth | jq .token -r > token.txt - - TOKEN=$(cat token.txt) - - >- - curl - --silent - -X DELETE - -H "Accept: application/vnd.docker.distribution.manifest.v2+json" - -H "Authorization: Bearer ${TOKEN}" - -G https://gitlab-registry.cern.ch/v2/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}/${CONTAINER}/manifests/sha256:${DIGEST} - - buildah --storage-driver vfs tag ${IMAGE_PREFIX}${CONTAINER}:${CI_COMMIT_SHA} ${IMAGE_PREFIX}${CONTAINER}:${TAG} - - buildah --storage-driver vfs push --creds gitlab-ci-token:$CI_BUILD_TOKEN ${IMAGE_PREFIX}${CONTAINER}:${TAG} docker://${IMAGE_PREFIX}${CONTAINER}:${TAG} - - done - only: - - tags - except: - - schedules - - /^cron.*$/ tiller_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "gcr.io/kubernetes-helm/tiller:canary" - only: - - schedules traefik_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "docker.io/library/traefik:alpine" - only: - - schedules draino_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "docker.io/planetlabs/draino:latest" - only: - - schedules node-problem-detector_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "k8s.gcr.io/node-problem-detector:v0.6.2" - only: - - schedules cluster-autoscaler_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "gitlab-registry.cern.ch/cloud/autoscaler/cluster-autoscaler:v1.15.2" - only: - - schedules metrics-server_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "gcr.io/google_containers/metrics-server-amd64:v0.3.1" - only: - - schedules prometheus_alertmanager_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "quay.io/prometheus/alertmanager:latest" - only: - - schedules prometheus_prometheus-operator_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "quay.io/coreos/prometheus-operator:latest" - only: - - schedules prometheus_configmap-reload_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "quay.io/coreos/configmap-reload:latest" - only: - - schedules prometheus_prometheus-config-reloader_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "quay.io/coreos/prometheus-config-reloader:master" - only: - - schedules prometheus_hyperkube_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "gcr.io/google-containers/hyperkube:v1.11.8" - only: - - schedules prometheus_prometheus_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "quay.io/prometheus/prometheus:latest" - only: - - schedules kubernetes-dashboard_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "gcr.io/google-containers/kubernetes-dashboard-amd64:v1.10.1" - only: - - schedules openstack-cloud-controller-manager_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "docker.io/k8scloudprovider/openstack-cloud-controller-manager:v0.2.0" - only: - - schedules cluster-proportional-autoscaler-amd64_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "gcr.io/google_containers/cluster-proportional-autoscaler-amd64:1.1.2" - only: - - schedules k8s-keystone-auth_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "docker.io/k8scloudprovider/k8s-keystone-auth:1.13.0" - only: - - schedules kubernetes-apiserver_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "docker.io/openstackmagnum/kubernetes-apiserver:v1.14.1" - only: - - schedules kubernetes-controller-manager_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "docker.io/openstackmagnum/kubernetes-controller-manager:v1.14.1" - only: - - schedules kubernetes-scheduler_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "docker.io/openstackmagnum/kubernetes-scheduler:v1.14.1" - only: - - schedules kubernetes-kubelet_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "docker.io/openstackmagnum/kubernetes-kubelet:v1.14.1" - only: - - schedules kubernetes-proxy_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "docker.io/openstackmagnum/kubernetes-proxy:v1.14.1" - only: - - schedules flannel_ds_sync: stage: image_sync @@ -281,125 +133,93 @@ flannel_ds_sync: script: - ./sync_image.sh "quay.io/coreos/flannel:v0.10.0-amd64" - ./sync_image.sh "docker.io/openstackmagnum/flannel:v0.9.0" - only: - - schedules flannel_cni_ds_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "quay.io/coreos/flannel-cni:v0.3.0" - only: - - schedules coredns_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "docker.io/coredns/coredns:1.3.1" - only: - - schedules helm_client_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "docker.io/openstackmagnum/helm-client:dev" - only: - - schedules k8s.gcr.io/defaultbackend_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "k8s.gcr.io/defaultbackend:1.4" - only: - - schedules quay.io/kubernetes-ingress-controller/nginx-ingress-controller_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.23.0" - only: - - schedules quay.io/k8scsi/csi-provisioner_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "quay.io/k8scsi/csi-provisioner:v1.3.0" - only: - - schedules quay.io/k8scsi/csi-attacher_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "quay.io/k8scsi/csi-attacher:v1.2.0" - only: - - schedules quay.io/k8scsi/csi-node-driver-registrar_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "quay.io/k8scsi/csi-node-driver-registrar:v1.1.0" - only: - - schedules quay.io/cephcsi/cephcsi_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "quay.io/cephcsi/cephcsi:canary" - only: - - schedules docker.io/calico/typha_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "docker.io/calico/typha:latest" - only: - - schedules docker.io/calico/node_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "docker.io/calico/node:latest" - only: - - schedules docker.io/calico/cni_sync: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "docker.io/calico/cni:latest" - only: - - schedules docker.io/directxman12/k8s-prometheus-adapter-amd64: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "docker.io/directxman12/k8s-prometheus-adapter-amd64:latest" - only: - - schedules docker.io/openstackmagnum/heat-container-agent: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "docker.io/openstackmagnum/heat-container-agent:train-dev" - only: - - schedules gcr.io/google-containers/fluentd-elasticsearch: stage: image_sync image: gitlab-registry.cern.ch/cloud/fedora-buildah:rawhide script: - ./sync_image.sh "gcr.io/google-containers/fluentd-elasticsearch:v2.4.0" - only: - - schedules diff --git a/cern-release b/cern-release deleted file mode 100755 index 134007cd3de82de5bb8e51109f3ae13d3d6c055b..0000000000000000000000000000000000000000 --- a/cern-release +++ /dev/null @@ -1,3 +0,0 @@ -KUBE_TAG="v1.13.3" -DOCKER_TAG="17.09-1" -RELEASE="12"