Skip to content
This repository was archived by the owner on Apr 16, 2025. It is now read-only.

Commit 9b80fb1

Browse files
committed
Bootstrap the Red Hat product devfile registry
Signed-off-by: John Collier <jcollier@redhat.com>
1 parent a8daa2d commit 9b80fb1

7 files changed

Lines changed: 334 additions & 0 deletions

File tree

.ci/Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#
2+
# Copyright (c) 2020 Red Hat, Inc.
3+
# This program and the accompanying materials are made
4+
# available under the terms of the Eclipse Public License 2.0
5+
# which is available at https://www.eclipse.org/legal/epl-2.0/
6+
#
7+
# SPDX-License-Identifier: EPL-2.0
8+
#
9+
FROM quay.io/openshift-pipeline/golang:1.15-alpine AS builder
10+
11+
# Install dependencies
12+
13+
RUN apk add --no-cache git bash curl zip
14+
15+
# Install yq
16+
RUN curl -sL -O https://github.com/mikefarah/yq/releases/download/v4.9.5/yq_linux_amd64 -o /usr/local/bin/yq && mv ./yq_linux_amd64 /usr/local/bin/yq && chmod +x /usr/local/bin/yq
17+
18+
COPY . /registry
19+
20+
# Download the registry build tools
21+
RUN git clone https://github.com/devfile/registry-support.git /registry-support
22+
23+
# Run the registry build tools
24+
RUN /registry-support/build-tools/build.sh /registry /build
25+
26+
FROM quay.io/devfile/devfile-index-base:next
27+
28+
COPY --from=builder /build /registry
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
apiVersion: v1
3+
kind: Template
4+
metadata:
5+
name: devfile-registry-acceptance
6+
objects:
7+
- apiVersion: batch/v1
8+
kind: Job
9+
metadata:
10+
name: devfile-registry-acceptance-${JOB_NAME}
11+
spec:
12+
backoffLimit: 5
13+
template:
14+
spec:
15+
restartPolicy: Never
16+
containers:
17+
- image: ${IMAGE}:${IMAGE_TAG}
18+
imagePullPolicy: Always
19+
name: github-mirror-acceptance
20+
env:
21+
- name: REGISTRY
22+
value: ${REGISTRY}
23+
parameters:
24+
- name: IMAGE
25+
value: quay.io/devfile/devfile-registry-integration
26+
- name: IMAGE_TAG
27+
value: "next"
28+
required: true
29+
- name: REGISTRY
30+
value: "https://registry.stage.devfile.io"
31+
required: true
32+
- name: JOB_NAME
33+
generate: expression
34+
from: "[a-z0-9]{5}"

.ci/build.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#
2+
# Copyright (c) 2021 Red Hat, Inc.
3+
# This program and the accompanying materials are made
4+
# available under the terms of the Eclipse Public License 2.0
5+
# which is available at https://www.eclipse.org/legal/epl-2.0/
6+
#
7+
# SPDX-License-Identifier: EPL-2.0
8+
#
9+
10+
#!/usr/bin/env bash
11+
# This script downloads the registry build tools and builds up this repository
12+
# This script runs on both the GitHub action CI and the CICD for the hosted registry
13+
14+
ABSOLUTE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15+
16+
docker build --no-cache -t devfile-index -f $ABSOLUTE_PATH/Dockerfile $ABSOLUTE_PATH/..

.ci/build_and_deploy.sh

Whitespace-only changes.

.ci/deploy/devfile-registry.yaml

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
#
2+
# Copyright (c) 2021 Red Hat, Inc.
3+
# This program and the accompanying materials are made
4+
# available under the terms of the Eclipse Public License 2.0
5+
# which is available at https://www.eclipse.org/legal/epl-2.0/
6+
#
7+
# SPDX-License-Identifier: EPL-2.0
8+
#
9+
---
10+
apiVersion: v1
11+
kind: Template
12+
metadata:
13+
name: devfile-registry
14+
objects:
15+
- apiVersion: apps/v1
16+
kind: Deployment
17+
metadata:
18+
labels:
19+
app: devfile-registry
20+
name: devfile-registry
21+
spec:
22+
replicas: ${{REPLICAS}}
23+
selector:
24+
matchLabels:
25+
app: devfile-registry
26+
strategy:
27+
type: RollingUpdate
28+
rollingUpdate:
29+
maxSurge: 25%
30+
maxUnavailable: 25%
31+
template:
32+
metadata:
33+
labels:
34+
app: devfile-registry
35+
spec:
36+
volumes:
37+
- name: devfile-registry-storage
38+
emptyDir: {}
39+
- name: config
40+
configMap:
41+
name: devfile-registry
42+
items:
43+
- key: registry-config.yml
44+
path: config.yml
45+
containers:
46+
- image: ${DEVFILE_INDEX_IMAGE}:${DEVFILE_INDEX_IMAGE_TAG}
47+
imagePullPolicy: "${DEVFILE_INDEX_PULL_POLICY}"
48+
name: devfile-registry
49+
ports:
50+
- containerPort: 8080
51+
livenessProbe:
52+
httpGet:
53+
path: /
54+
port: 8080
55+
initialDelaySeconds: 30
56+
periodSeconds: 10
57+
timeoutSeconds: 3
58+
readinessProbe:
59+
httpGet:
60+
path: /
61+
port: 8080
62+
initialDelaySeconds: 3
63+
periodSeconds: 10
64+
timeoutSeconds: 3
65+
resources:
66+
requests:
67+
cpu: 1m
68+
memory: 5Mi
69+
limits:
70+
cpu: 100m
71+
memory: ${DEVFILE_INDEX_MEMORY_LIMIT}
72+
- image: ${OCI_REGISTRY_IMAGE}:${OCI_REGISTRY_IMAGE_TAG}
73+
imagePullPolicy: "${OCI_REGISTRY_PULL_POLICY}"
74+
name: oci-registry
75+
livenessProbe:
76+
httpGet:
77+
path: /v2/
78+
port: 5000
79+
initialDelaySeconds: 30
80+
periodSeconds: 10
81+
timeoutSeconds: 3
82+
readinessProbe:
83+
httpGet:
84+
path: /v2/
85+
port: 5000
86+
initialDelaySeconds: 3
87+
periodSeconds: 10
88+
timeoutSeconds: 3
89+
resources:
90+
requests:
91+
cpu: 1m
92+
memory: 5Mi
93+
limits:
94+
cpu: 100m
95+
memory: ${OCI_REGISTRY_MEMORY_LIMIT}
96+
volumeMounts:
97+
- name: devfile-registry-storage
98+
mountPath: "/var/lib/registry"
99+
- name: config
100+
mountPath: "/etc/docker/registry"
101+
readOnly: true
102+
- apiVersion: v1
103+
kind: Service
104+
metadata:
105+
name: devfile-registry
106+
labels:
107+
app: devfile-registry
108+
spec:
109+
ports:
110+
- name: http
111+
protocol: TCP
112+
port: 8080
113+
targetPort: 8080
114+
- name: oci-metrics
115+
protocol: TCP
116+
port: 5001
117+
targetPort: 5001
118+
- name: index-metrics
119+
protocol: TCP
120+
port: 7071
121+
targetPort: 7071
122+
selector:
123+
app: devfile-registry
124+
- apiVersion: v1
125+
kind: ConfigMap
126+
metadata:
127+
name: devfile-registry
128+
annotations:
129+
qontract.recycle: "true"
130+
data:
131+
registry-config.yml: |
132+
version: 0.1
133+
log:
134+
fields:
135+
service: registry
136+
storage:
137+
cache:
138+
blobdescriptor: inmemory
139+
filesystem:
140+
rootdirectory: /var/lib/registry
141+
http:
142+
addr: :5000
143+
headers:
144+
X-Content-Type-Options: [nosniff]
145+
debug:
146+
addr: :5001
147+
prometheus:
148+
enabled: true
149+
path: /metrics
150+
151+
parameters:
152+
- name: DEVFILE_INDEX_IMAGE
153+
value: quay.io/app-sre/product-devfile-index
154+
displayName: Devfile registry index image
155+
description: Devfile registry index docker image. Defaults to quay.io/devfile/devfile-index
156+
- name: DEVFILE_INDEX_IMAGE_TAG
157+
value: next
158+
displayName: Devfile registry version
159+
description: Devfile registry version which defaults to next
160+
- name: DEVFILE_INDEX_MEMORY_LIMIT
161+
value: 256Mi
162+
displayName: Memory Limit
163+
description: Maximum amount of memory the container can use. Defaults 256Mi
164+
- name: DEVFILE_INDEX_PULL_POLICY
165+
value: Always
166+
displayName: Devfile registry image pull policy
167+
description: Always pull by default. Can be IfNotPresent
168+
- name: OCI_REGISTRY_IMAGE
169+
value: quay.io/devfile/oci-registry
170+
displayName: OCI registry index image
171+
description: OCI registry index docker image. Defaults to quay.io/devfile/devfile-index
172+
- name: OCI_REGISTRY_IMAGE_TAG
173+
value: next
174+
displayName: OCI registry version
175+
description: OCI registry version which defaults to next
176+
- name: OCI_REGISTRY_MEMORY_LIMIT
177+
value: 256Mi
178+
displayName: Memory Limit
179+
description: Maximum amount of memory the OCI registry container can use. Defaults 256Mi
180+
- name: OCI_REGISTRY_PULL_POLICY
181+
value: Always
182+
displayName: Devfile registry image pull policy
183+
description: Always pull by default. Can be IfNotPresent
184+
- name: REPLICAS
185+
value: "1"
186+
displayName: Devfile registry replicas
187+
description: The number of replicas for the hosted devfile registry service

.github/workflows/ci.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# Copyright (c) 2020 Red Hat, Inc.
3+
# This program and the accompanying materials are made
4+
# available under the terms of the Eclipse Public License 2.0
5+
# which is available at https://www.eclipse.org/legal/epl-2.0/
6+
#
7+
# SPDX-License-Identifier: EPL-2.0
8+
#
9+
name: CI
10+
11+
on:
12+
push:
13+
branches: [ main ]
14+
pull_request:
15+
branches: [ main ]
16+
17+
jobs:
18+
build:
19+
name: Check registry build
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Check out code
23+
uses: actions/checkout@v2
24+
with:
25+
path: registry-repo
26+
- name: Setup Go environment
27+
uses: actions/setup-go@v2
28+
with:
29+
go-version: 1.13
30+
31+
- name: Check if devfile registry build is working
32+
run: registry-repo/.ci/build.sh

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,39 @@
11
# devfile-registry
2+
23
Source repository for the Red Hat product devfile registry
4+
5+
This product devfile registry is updated weekly, by 12pm EST Wednesdays, with any updated stacks in this repository.
6+
7+
## Registry Updates
8+
9+
The staging product devfile registry is refreshed upon each commit to main in this repository. Production is promoted manually and as mentioned above, is done each Wednesday, as needed.
10+
11+
If you are a stack owner and need to request an urgent refresh of the registry service before Wednesday (for example if a stack is broken), please open an issue in this repository outlining the following:
12+
13+
- Stack name
14+
- Why the refresh is needed
15+
- Why the refresh cannot wait until the next regularly scheduled refresh
16+
17+
## Developing
18+
19+
### Prerequisites
20+
21+
- Docker 17.06 or later
22+
- Git
23+
24+
### Build
25+
26+
To build this devfile registry into a container image run `.ci/build.sh`. A container image will be built using the [devfile registry build tools](https://github.com/devfile/registry-support/tree/master/build-tools).
27+
28+
From there, push the container image to a container registry of your choice and deploy using one of the methods outlined [here](https://github.com/devfile/registry-support#deploy).
29+
30+
## Contributing
31+
32+
For contributing Devfile stacks to this registry, please see [CONTRIBUTING.md](CONTRIBUTING.md).
33+
34+
35+
## Reporting any issue
36+
37+
For issues relating to a specific devfile stack in this repository, please reach out to the devfile stack maintainer to determine where to open an issue.
38+
39+
For issues relating to the hosted product devfile registry service in general, please use this repository for opening issues.

0 commit comments

Comments
 (0)