Dex Chart Collator - Quay.io Docker image
This patchset includes Dex Chart Collator, which generates a Docker image to be used by the Helm operator to deploy Dex on a Target cluster. Change-Id: Id232cc5b0d3725d110a0711f22d2e83bbc030d29
This commit is contained in:
parent
20bf55629a
commit
a3c6b4454a
@ -21,8 +21,9 @@ RUN apt-get update && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY playbooks /opt/playbooks
|
||||
COPY config /opt/config
|
||||
|
||||
ARG CHARTS=""
|
||||
ARG CHARTS="/opt/config/charts.yaml"
|
||||
RUN ansible-playbook -v /opt/playbooks/create_repository.yaml \
|
||||
-i /opt/playbooks/inventory.yaml \
|
||||
--extra-vars "CHARTS=$CHARTS"
|
||||
|
@ -18,12 +18,13 @@ PUSH_IMAGE ?= false
|
||||
IMAGE_ID ?= none
|
||||
COMMIT ?= $(shell git rev-parse HEAD)
|
||||
LABEL ?= org.airshipit.build=community
|
||||
IMAGE_NAME ?= collator
|
||||
IMAGE_NAME ?= helm-chart-collator
|
||||
DOCKER_REGISTRY ?= quay.io
|
||||
IMAGE_PREFIX ?= airshipit
|
||||
IMAGE_TAG ?= latest
|
||||
DISTRO ?= debian_stable
|
||||
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}-${DISTRO}
|
||||
CHARTS ?= \"$(cat "config/charts.yaml")\"
|
||||
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
|
||||
SH_TO_CHECK := $(wildcard files/*.sh )
|
||||
PROXY ?= http://proxy.foo.com:8000
|
||||
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
|
||||
@ -74,31 +75,23 @@ build_collator:
|
||||
mkdir -p $(BUILD_DIR)
|
||||
ifeq ($(IMAGE_ID), none)
|
||||
ifeq ($(USE_PROXY), true)
|
||||
docker build . \
|
||||
--iidfile $(BUILD_DIR)/image_id \
|
||||
--tag $(IMAGE) \
|
||||
--label $(LABEL) \
|
||||
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
||||
--label "org.opencontainers.image.created=\
|
||||
$(shell date --rfc-3339=seconds --utc)" \
|
||||
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
|
||||
--build-arg http_proxy=$(PROXY) \
|
||||
--build-arg https_proxy=$(PROXY) \
|
||||
--build-arg HTTP_PROXY=$(PROXY) \
|
||||
--build-arg HTTPS_PROXY=$(PROXY) \
|
||||
--build-arg no_proxy=$(NO_PROXY) \
|
||||
--build-arg NO_PROXY=$(NO_PROXY) \
|
||||
--build-arg GIT_COMMIT=$(COMMIT)
|
||||
./build-image-make.sh \
|
||||
config/charts.yaml \
|
||||
$(IMAGE_NAME) \
|
||||
$(IMAGE) \
|
||||
$(LABEL) \
|
||||
$(BUILD_DIR) \
|
||||
$(USE_PROXY) \
|
||||
$(PROXY) \
|
||||
$(NO_PROXY)
|
||||
else
|
||||
docker build . \
|
||||
--iidfile $(BUILD_DIR)/image_id \
|
||||
--tag $(IMAGE) \
|
||||
--label $(LABEL) \
|
||||
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
||||
--label "org.opencontainers.image.created=\
|
||||
$(shell date --rfc-3339=seconds --utc)" \
|
||||
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
|
||||
--build-arg GIT_COMMIT=$(COMMIT)
|
||||
./build-image-make.sh \
|
||||
config/charts.yaml \
|
||||
$(IMAGE_NAME) \
|
||||
$(IMAGE) \
|
||||
$(LABEL) \
|
||||
$(BUILD_DIR) \
|
||||
$(USE_PROXY)
|
||||
endif
|
||||
else
|
||||
echo $(IMAGE_ID) > $(BUILD_DIR)/image_id
|
||||
|
70
helm-chart-collator/build-image-make.sh
Executable file
70
helm-chart-collator/build-image-make.sh
Executable file
@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
|
||||
# set -xe
|
||||
|
||||
if [[ $# < 5 ]]; then
|
||||
echo "usage:"
|
||||
echo " $0 \\\n"
|
||||
echo " <charts filename> \\\n"
|
||||
echo " <image name> \\\n"
|
||||
echo " <image uri> \\\n"
|
||||
echo " <label> \\\n"
|
||||
echo " <build dir> \\\n"
|
||||
echo " <use proxy? true|false> \\\n"
|
||||
echo " [<proxy> <no-proxy>] \\\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CHARTS=$1
|
||||
IMAGE_NAME=$2
|
||||
IMAGE_URI=$3
|
||||
LABEL=$4
|
||||
BUILD_DIR=$5
|
||||
USE_PROXY=$6
|
||||
COMMIT=$(git rev-parse HEAD)
|
||||
|
||||
echo "Building the Docker image = ${IMAGE}"
|
||||
echo " CHARTS=$CHARTS"
|
||||
echo " IMAGE_NAME=$IMAGE_NAME"
|
||||
echo " IMAGE_URI=$IMAGE_URI"
|
||||
echo " LABEL=$LABEL"
|
||||
echo " BUILD_DIR=$BUILD_DIR"
|
||||
echo " COMMIT=$COMMIT"
|
||||
echo " USE_PROXY=$USE_PROXY"
|
||||
|
||||
if [ $USE_PROXY == "true" ]; then
|
||||
PROXY=$8
|
||||
NO_PROXY=$9
|
||||
|
||||
echo "Building Docker image ${IMAGE} with PROXY"
|
||||
docker build . \
|
||||
--iidfile ${BUILD_DIR}/image_id \
|
||||
--tag ${IMAGE_URI} \
|
||||
--label ${LABEL} \
|
||||
--label "org.opencontainers.image.revision=${COMMIT}" \
|
||||
--label "org.opencontainers.image.created=\
|
||||
$(date --rfc-3339=seconds --utc)" \
|
||||
--label "org.opencontainers.image.title=${IMAGE_NAME}" \
|
||||
--force-rm=true \
|
||||
--build-arg "CHARTS=\"$(cat "${CHARTS}")\"" \
|
||||
--build-arg http_proxy=${PROXY} \
|
||||
--build-arg https_proxy=${PROXY} \
|
||||
--build-arg HTTP_PROXY=${PROXY} \
|
||||
--build-arg HTTPS_PROXY=${PROXY} \
|
||||
--build-arg no_proxy=${NO_PROXY} \
|
||||
--build-arg NO_PROXY=${NO_PROXY} \
|
||||
--build-arg GIT_COMMIT=${COMMIT}
|
||||
else
|
||||
echo "Building Docker image ${IMAGE} without PROXY"
|
||||
docker build . \
|
||||
--iidfile ${BUILD_DIR}/image_id \
|
||||
--tag ${IMAGE_URI} \
|
||||
--label ${LABEL} \
|
||||
--label "org.opencontainers.image.revision=${COMMIT}" \
|
||||
--label "org.opencontainers.image.created=\
|
||||
$(date --rfc-3339=seconds --utc)" \
|
||||
--label "org.opencontainers.image.title=${IMAGE_NAME}" \
|
||||
--force-rm=true \
|
||||
--build-arg "CHARTS=\"$(cat "${CHARTS}")\"" \
|
||||
--build-arg GIT_COMMIT=${COMMIT}
|
||||
fi
|
@ -1,8 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -xe
|
||||
|
||||
if [[ $# != 1 ]]; then
|
||||
printf "usage: ./%s <filename>\n" "$0"
|
||||
printf "usage: $0 <filename>\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker build . -t helm-chart-collator --build-arg "CHARTS=\"$(cat "$1")\""
|
||||
IMAGE_NAME="${IMAGE_NAME:-helm-chart-collator}"
|
||||
DOCKER_REGISTRY="${DOCKER_REGISTRY:-quay.io}"
|
||||
IMAGE_PREFIX="${IMAGE_PREFIX:-airshipit}"
|
||||
IMAGE_TAG="${IMAGE_TAG:-latest}"
|
||||
|
||||
image=${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
|
||||
echo "Building the ${image}"
|
||||
docker build . -t $image --build-arg "CHARTS=\"$(cat "$1")\""
|
||||
|
21
helm-chart-collator/config/charts.yaml
Normal file
21
helm-chart-collator/config/charts.yaml
Normal file
@ -0,0 +1,21 @@
|
||||
git_repos:
|
||||
- name: dex-aio
|
||||
url: https://review.opendev.org/airship/charts
|
||||
path: charts/dex-aio
|
||||
refspec: refs/heads/master
|
||||
chart_version: 1.0.0
|
||||
- name: jarvis-project
|
||||
url: https://review.opendev.org/airship/charts
|
||||
path: charts/jarvis-project
|
||||
refspec: refs/heads/master
|
||||
chart_version: 1.0.0
|
||||
- name: jarvis-system
|
||||
url: https://review.opendev.org/airship/charts
|
||||
path: charts/jarvis-system
|
||||
refspec: refs/heads/master
|
||||
chart_version: 1.0.0
|
||||
- name: harbor
|
||||
url: https://review.opendev.org/airship/charts
|
||||
path: charts/harbor
|
||||
refspec: refs/heads/master
|
||||
chart_version: 1.0.0
|
Loading…
Reference in New Issue
Block a user