[ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
}
-function generate_docker_images() {
+function pull_docker_images() {
[ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
- echo "Pulling and generating docker images"
- [ -n "${DOCKER_REGISTRY_URL}" ] && docker_login
-
echo "Pulling docker images"
+ [ -n "${DOCKER_REGISTRY_URL}" ] && docker_login
+ echo "Pulling non-OSM docker images"
if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q KAFKA ; then
sg docker -c "docker pull wurstmeister/zookeeper" || FATAL "cannot get zookeeper docker image"
sg docker -c "docker pull wurstmeister/kafka:${KAFKA_TAG}" || FATAL "cannot get kafka docker image"
sg docker -c "docker pull mysql:5" || FATAL "cannot get mysql docker image"
fi
- if [ -n "$PULL_IMAGES" ]; then
- echo "Pulling OSM docker images"
- for module in MON POL NBI KEYSTONE RO LCM NG-UI PLA osmclient; do
+ echo "Pulling OSM docker images"
+ for module in MON POL NBI KEYSTONE RO LCM NG-UI PLA osmclient Airflow; do
+ module_lower=${module,,}
+ if [ $module == "PLA" -a ! -n "$INSTALL_PLA" ]; then
+ continue
+ fi
+ module_tag="${OSM_DOCKER_TAG}"
+ if [ -n "${MODULE_DOCKER_TAG}" ] && echo $TO_REBUILD | grep -q $module ; then
+ module_tag="${MODULE_DOCKER_TAG}"
+ fi
+ echo "Pulling ${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module_lower}:${module_tag} docker image"
+ sg docker -c "docker pull ${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module_lower}:${module_tag}" || FATAL "cannot pull $module docker image"
+ done
+
+ echo "Finished pulling docker images"
+ [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
+}
+
+function generate_docker_images() {
+ [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
+ echo "Generating docker images"
+ _build_from=$COMMIT_ID
+ [ -z "$_build_from" ] && _build_from="latest"
+ echo "OSM Docker images generated from $_build_from"
+ LWTEMPDIR="$(mktemp -d -q --tmpdir "installosmlight.XXXXXX")"
+ trap 'rm -rf "${LWTEMPDIR}"' EXIT
+ for module in MON POL NBI KEYSTONE RO LCM NG-UI PLA; do
+ if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q ${module} ; then
module_lower=${module,,}
if [ $module == "PLA" -a ! -n "$INSTALL_PLA" ]; then
continue
fi
- module_tag="${OSM_DOCKER_TAG}"
- if [ -n "${MODULE_DOCKER_TAG}" ] && echo $TO_REBUILD | grep -q $module ; then
- module_tag="${MODULE_DOCKER_TAG}"
- fi
- echo "Pulling ${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module_lower}:${module_tag} docker image"
- sg docker -c "docker pull ${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module_lower}:${module_tag}" || FATAL "cannot pull $module docker image"
- done
- else
- _build_from=$COMMIT_ID
- [ -z "$_build_from" ] && _build_from="latest"
- echo "OSM Docker images generated from $_build_from"
- LWTEMPDIR="$(mktemp -d -q --tmpdir "installosmlight.XXXXXX")"
- trap 'rm -rf "${LWTEMPDIR}"' EXIT
- for module in MON POL NBI KEYSTONE RO LCM NG-UI PLA; do
- if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q ${module} ; then
- module_lower=${module,,}
- if [ $module == "PLA" -a ! -n "$INSTALL_PLA" ]; then
- continue
- fi
- git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/$module
- git -C ${LWTEMPDIR}/${module} checkout ${COMMIT_ID}
- sg docker -c "docker build ${LWTEMPDIR}/${module} -f ${LWTEMPDIR}/${module}/docker/Dockerfile -t ${DOCKER_USER}/${module_lower} --no-cache" || FATAL "cannot build ${module} docker image"
- fi
- done
- if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q osmclient; then
- BUILD_ARGS+=(--build-arg REPOSITORY="$REPOSITORY")
- BUILD_ARGS+=(--build-arg RELEASE="$RELEASE")
- BUILD_ARGS+=(--build-arg REPOSITORY_KEY="$REPOSITORY_KEY")
- BUILD_ARGS+=(--build-arg REPOSITORY_BASE="$REPOSITORY_BASE")
- sg docker -c "docker build -t ${DOCKER_USER}/osmclient ${BUILD_ARGS[@]} -f $OSM_DEVOPS/docker/osmclient ."
+ git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/$module
+ git -C ${LWTEMPDIR}/${module} checkout ${COMMIT_ID}
+ sg docker -c "docker build ${LWTEMPDIR}/${module} -f ${LWTEMPDIR}/${module}/docker/Dockerfile -t ${DOCKER_USER}/${module_lower} --no-cache" || FATAL "cannot build ${module} docker image"
fi
- echo "Finished generation of docker images"
+ done
+ if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q osmclient; then
+ BUILD_ARGS+=(--build-arg REPOSITORY="$REPOSITORY")
+ BUILD_ARGS+=(--build-arg RELEASE="$RELEASE")
+ BUILD_ARGS+=(--build-arg REPOSITORY_KEY="$REPOSITORY_KEY")
+ BUILD_ARGS+=(--build-arg REPOSITORY_BASE="$REPOSITORY_BASE")
+ sg docker -c "docker build -t ${DOCKER_USER}/osmclient ${BUILD_ARGS[@]} -f $OSM_DEVOPS/docker/osmclient ."
fi
-
- echo "Finished pulling and generating docker images"
+ echo "Finished generation of docker images"
[ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
}
fi
# Deploy OSM services
- [ -z "$DOCKER_NOBUILD" ] && generate_docker_images
+ [ -z "$DOCKER_NOBUILD" ] && pull_docker_images
+ [ -z "$DOCKER_NOBUILD" ] && [ -z "$PULL_IMAGES" ] && generate_docker_images
track docker_images docker_images_ok
generate_k8s_manifest_files