Skip to content

Commit 645ad3a

Browse files
authored
Merge pull request #149 from michael-valdron/update-pipeline
Update build and deploy pipeline
2 parents 2257878 + e859707 commit 645ad3a

File tree

5 files changed

+97
-38
lines changed

5 files changed

+97
-38
lines changed

.ci/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ RUN git clone https://github.com/devfile/registry-support.git /registry-support
2929
# Run the registry build tools
3030
RUN /registry-support/build-tools/build.sh /registry /build
3131

32-
FROM quay.io/devfile/devfile-index-base:f16affcff745d534d19bc73d63e12bf8e2bf4d04
32+
FROM quay.io/devfile/devfile-index-base:next
3333

3434
COPY --from=builder /build /registry

.ci/build_and_deploy.sh

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,40 @@
1515
set -ex
1616
ABSOLUTE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1717
GIT_REV="$(git rev-parse --short=7 HEAD)"
18-
IMAGE="${IMAGE:-quay.io/app-sre/devfile-index}"
18+
INDEX_IMAGE="${INDEX_IMAGE:-quay.io/app-sre/devfile-index}"
19+
VIEWER_IMAGE="${VIEWER_IMAGE:-quay.io/app-sre/registry-viewer}"
1920
IMAGE_TAG="${IMAGE_TAG:-${GIT_REV}}"
2021

2122
# Run the build script
2223
$ABSOLUTE_PATH/build.sh
2324

24-
# Push the iamge to quay.io
25+
# Clone devfile-web for building registry-viewer
26+
if [ -d $ABSOLUTE_PATH/devfile-web ]
27+
then
28+
rm -rf $ABSOLUTE_PATH/devfile-web
29+
fi
30+
git clone https://github.com/devfile/devfile-web.git $ABSOLUTE_PATH/devfile-web
31+
32+
# Build registry-viewer
33+
bash $ABSOLUTE_PATH/devfile-web/scripts/build_viewer.sh
34+
35+
# Push the image to quay.io
2536
if [[ -n "$QUAY_USER" && -n "$QUAY_TOKEN" ]]; then
2637
DOCKER_CONF="$PWD/.docker"
2738
mkdir -p "$DOCKER_CONF"
28-
docker tag devfile-index "${IMAGE}:${IMAGE_TAG}"
29-
docker tag devfile-index "${IMAGE}:next"
39+
40+
# login into quay.io
3041
docker --config="$DOCKER_CONF" login -u="$QUAY_USER" -p="$QUAY_TOKEN" quay.io
31-
docker --config="$DOCKER_CONF" push "${IMAGE}:${IMAGE_TAG}"
32-
docker --config="$DOCKER_CONF" push "${IMAGE}:next"
42+
43+
# devfile-index
44+
docker tag devfile-index "${INDEX_IMAGE}:${IMAGE_TAG}"
45+
docker tag devfile-index "${INDEX_IMAGE}:next"
46+
docker --config="$DOCKER_CONF" push "${INDEX_IMAGE}:${IMAGE_TAG}"
47+
docker --config="$DOCKER_CONF" push "${INDEX_IMAGE}:next"
48+
49+
# registry-viewer
50+
docker tag registry-viewer "${VIEWER_IMAGE}:${IMAGE_TAG}"
51+
docker tag registry-viewer "${VIEWER_IMAGE}:next"
52+
docker --config="$DOCKER_CONF" push "${VIEWER_IMAGE}:${IMAGE_TAG}"
53+
docker --config="$DOCKER_CONF" push "${VIEWER_IMAGE}:next"
3354
fi

.ci/deploy/devfile-registry.yaml

Lines changed: 67 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ objects:
4949
items:
5050
- key: registry-config.yml
5151
path: config.yml
52-
- name: viewer-config
52+
- name: viewer-env-file
5353
configMap:
5454
name: devfile-registry
5555
items:
56-
- key: devfile-registry-hosts.json
57-
path: devfile-registry-hosts.json
56+
- key: .env.registry-viewer
57+
path: .env.local
5858
containers:
5959
- image: ${DEVFILE_INDEX_IMAGE}:${IMAGE_TAG}
6060
imagePullPolicy: "${DEVFILE_INDEX_PULL_POLICY}"
@@ -84,14 +84,6 @@ objects:
8484
initialDelaySeconds: 15
8585
periodSeconds: 10
8686
timeoutSeconds: 3
87-
startupProbe:
88-
httpGet:
89-
path: /viewer
90-
port: 8080
91-
scheme: HTTP
92-
initialDelaySeconds: 30
93-
periodSeconds: 10
94-
timeoutSeconds: 10
9587
resources:
9688
requests:
9789
cpu: 100m
@@ -100,20 +92,60 @@ objects:
10092
cpu: 250m
10193
memory: ${DEVFILE_INDEX_MEMORY_LIMIT}
10294
env:
103-
- name: DEVFILE_VIEWER_ROOT
104-
value: "/viewer"
10595
- name: ENABLE_TELEMETRY
10696
value: ${ENABLE_TELEMETRY}
10797
- name: REGISTRY_NAME
10898
value: ${REGISTRY_NAME}
109-
- name: ANALYTICS_WRITE_KEY
110-
value: ${ANALYTICS_WRITE_KEY}
11199
- name: TELEMETRY_KEY
112100
value: ${TELEMETRY_KEY}
101+
- image: ${REGISTRY_VIEWER_IMAGE}:${IMAGE_TAG}
102+
imagePullPolicy: "${REGISTRY_VIEWER_PULL_POLICY}"
103+
name: devfile-registry-viewer
104+
ports:
105+
- containerPort: 3000
106+
securityContext:
107+
allowPrivilegeEscalation: false
108+
runAsNonRoot: true
109+
capabilities:
110+
drop: ["ALL"]
111+
seccompProfile:
112+
type: "RuntimeDefault"
113+
livenessProbe:
114+
httpGet:
115+
path: /viewer
116+
port: 3000
117+
scheme: HTTP
118+
initialDelaySeconds: 15
119+
periodSeconds: 10
120+
timeoutSeconds: 3
121+
readinessProbe:
122+
httpGet:
123+
path: /viewer
124+
port: 3000
125+
scheme: HTTP
126+
initialDelaySeconds: 15
127+
periodSeconds: 10
128+
timeoutSeconds: 3
129+
startupProbe:
130+
httpGet:
131+
path: /viewer
132+
port: 3000
133+
scheme: HTTP
134+
initialDelaySeconds: 30
135+
periodSeconds: 10
136+
timeoutSeconds: 10
137+
resources:
138+
requests:
139+
cpu: 100m
140+
memory: 64Mi
141+
limits:
142+
cpu: 250m
143+
memory: ${REGISTRY_VIEWER_MEMORY_LIMIT}
113144
volumeMounts:
114-
- name: viewer-config
115-
mountPath: "/app/config"
116-
readOnly: false
145+
- name: viewer-env-file
146+
mountPath: /app/apps/registry-viewer/.env.local
147+
subPath: .env.local
148+
readOnly: true
117149
- image: ${OCI_REGISTRY_IMAGE}:${OCI_REGISTRY_IMAGE_TAG}
118150
imagePullPolicy: "${OCI_REGISTRY_PULL_POLICY}"
119151
name: oci-registry
@@ -201,13 +233,10 @@ objects:
201233
enabled: true
202234
path: /metrics
203235
204-
devfile-registry-hosts.json: |
205-
{
206-
"Community": {
207-
"url": "http://localhost:8080",
208-
"alias": "${REGISTRY_HOST_ALIAS}"
209-
}
210-
}
236+
.env.registry-viewer: |
237+
ANALYTICS_WRITE_KEY=${ANALYTICS_WRITE_KEY}
238+
DEVFILE_REGISTRIES=[{"name":"Community","url":"http://localhost:8080","fqdn":"${REGISTRY_HOST_ALIAS}"}]
239+
211240
- apiVersion: v1
212241
kind: ServiceAccount
213242
metadata:
@@ -219,10 +248,10 @@ parameters:
219248
value: quay.io/devfile/devfile-index
220249
displayName: Devfile registry index image
221250
description: Devfile registry index docker image. Defaults to quay.io/devfile/devfile-index
222-
- name: DEVFILE_INDEX_IMAGE_TAG
223-
value: next
224-
displayName: Devfile registry version
225-
description: Devfile registry version which defaults to next
251+
- name: REGISTRY_VIEWER_IMAGE
252+
value: quay.io/devfile/registry-viewer
253+
displayName: Devfile registry viewer image
254+
description: Devfile registry viewer docker image. Defaults to quay.io/devfile/registry-viewer
226255
- name: IMAGE_TAG
227256
value: next
228257
displayName: Devfile registry version
@@ -235,6 +264,14 @@ parameters:
235264
value: Always
236265
displayName: Devfile registry image pull policy
237266
description: Always pull by default. Can be IfNotPresent
267+
- name: REGISTRY_VIEWER_MEMORY_LIMIT
268+
value: 256Mi
269+
displayName: Memory Limit
270+
description: Maximum amount of memory the registry viewer container can use. Defaults 256Mi
271+
- name: REGISTRY_VIEWER_PULL_POLICY
272+
value: Always
273+
displayName: Devfile registry viewer image pull policy
274+
description: Always pull by default. Can be IfNotPresent
238275
- name: OCI_REGISTRY_IMAGE
239276
value: quay.io/devfile/oci-registry
240277
displayName: OCI registry index image
@@ -249,7 +286,7 @@ parameters:
249286
description: Maximum amount of memory the OCI registry container can use. Defaults 256Mi
250287
- name: OCI_REGISTRY_PULL_POLICY
251288
value: Always
252-
displayName: Devfile registry image pull policy
289+
displayName: OCI registry image pull policy
253290
description: Always pull by default. Can be IfNotPresent
254291
- name: REPLICAS
255292
value: "1"

.ci/openshift_integration.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ curl -sL https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift
4343
export GLOBALODOCONFIG=$(pwd)/preferences.yaml
4444

4545
# Install the devfile registry
46-
oc process -f .ci/deploy/devfile-registry.yaml -p DEVFILE_INDEX_IMAGE=$IMG -p IMAGE_TAG=$TAG -p REPLICAS=3 | \
46+
oc process -f .ci/deploy/devfile-registry.yaml -p DEVFILE_INDEX_IMAGE=$IMG -p IMAGE_TAG=$TAG -p REPLICAS=3 -p ANALYTICS_WRITE_KEY= | \
4747
oc apply -f -
4848

4949
# Deploy the routes for the registry

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
index-generator
22
registry-support/
33
.idea/
4+
devfile-web/

0 commit comments

Comments
 (0)