Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6 from PizzaFactory/pr-update-to-the-upstream
Browse files Browse the repository at this point in the history
Update to the upstream
  • Loading branch information
monaka authored Jul 29, 2019
2 parents d03165e + 462c317 commit 5123de1
Show file tree
Hide file tree
Showing 53 changed files with 664 additions and 186 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Global Owners
* @vparfonov @l0rd @rhopp @skabashnyuk
14 changes: 0 additions & 14 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/where-to-report-issues.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: "⚠️ Where to report issues?"
about: File issues in the main Eclipse Che repository at https://github.com/eclipse/che/issues
title: Issues need to be filed in the main Eclipse Che repository
labels: ''
assignees: ''

---

## Where to report issues?

This repository is not the primary repository of Eclipse Che.

🚨 Please don't submit new issues here. 🚨

All issues for Eclipse Che are managed at [https://github.com/eclipse/che/issues](https://github.com/eclipse/che/issues).
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[![Build Status](https://ci.centos.org/buildStatus/icon?job=devtools-che-devfile-registry-build-master/)](https://ci.centos.org/job/devtools-che-devfile-registry-build-master/)
[![Build Status](https://ci.centos.org/buildStatus/icon?job=devtools-che-devfile-registry-nightly/)](https://ci.centos.org/job/devtools-che-devfile-registry-nightly/)
[![Build Status](https://ci.centos.org/buildStatus/icon?job=devtools-che-devfile-registry-release/)](https://ci.centos.org/job/devtools-che-devfile-registry-release/)

# Eclipse Che devfile registry

Expand All @@ -8,22 +10,22 @@ This repository holds ready-to-use Devfiles for different languages and technolo

Execute
```shell
docker build --no-cache -t openshiftio/che-devfile-registry .
docker build --no-cache -t quay.io/eclipse/che-devfile-registry:nightly .
```
Where `--no-cache` is needed to prevent usage of cached layers with devfile registry files.
Useful when you change devfile files and rebuild the image.

Note that the Dockerfiles feature multi-stage build, so it requires Docker of version 17.05 and higher.
Though you may also just provide the image to the older versions of Docker (ex. on Minishift) by having it build on newer version, and pushing and pulling it from Docker Hub.

`quay.io/openshiftio/che-devfile-registry:latest` image would be rebuilt after each commit in master
`quay.io/eclipse/che-devfile-registry:nightly` image would be rebuilt after each commit in master.

## OpenShift
You can deploy Che devfile registry on Openshift with command.
```
oc new-app -f deploy/openshift/che-devfile-registry.yaml \
-p IMAGE="quay.io/openshiftio/che-devfile-registry" \
-p IMAGE_TAG="latest" \
-p IMAGE="quay.io/eclipse/che-devfile-registry" \
-p IMAGE_TAG="nightly" \
-p PULL_POLICY="Always"
```

Expand Down Expand Up @@ -52,8 +54,9 @@ helm delete --purge che-devfile-registry
```

## Docker

```
docker run -it --rm -p 8080:8080 quay.io/openshiftio/che-devfile-registry
docker run -it --rm -p 8080:8080 quay.io/eclipse/che-devfile-registry:nightly
```

### License
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.0.0-SNAPSHOT
15 changes: 15 additions & 0 deletions arbitrary-users-patch/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ARG FROM_IMAGE
FROM ${FROM_IMAGE}
USER 0
# Set permissions on /etc/passwd and /home to allow arbitrary users to write
RUN mkdir -p /home/user
RUN chgrp -R 0 /home
RUN chmod -R g=u /etc/passwd /home
COPY [--chown=0:0] entrypoint.sh /
RUN chmod +x /entrypoint.sh

USER 10001
ENV HOME=/home/user
WORKDIR /projects
ENTRYPOINT [ "/entrypoint.sh" ]
CMD ["tail", "-f", "/dev/null"]
10 changes: 10 additions & 0 deletions arbitrary-users-patch/base_images
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
che-python-3.6 centos/python-36-centos7:1
che-php-7 eclipse/php:7.1-che7
che-golang-1.10 golang:1.10.7-stretch
che-java11-gradle gradle:5.2.1-jdk11
che-java11-maven maven:3.6.0-jdk-11
che-java8-maven maven:3.6.1-jdk-8
che-dotnet-2.2 mcr.microsoft.com/dotnet/core/sdk:2.2-stretch
che-nodejs10-community node:10.16
che-nodejs10-ubi registry.access.redhat.com/ubi8/nodejs-10
che-nodejs8-centos registry.centos.org/che-stacks/centos-nodejs
39 changes: 39 additions & 0 deletions arbitrary-users-patch/build_images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
#
# Copyright (c) 2012-2018 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

set -e

SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd)

DEFAULT_REGISTRY="quay.io"
DEFAULT_ORGANIZATION="eclipse"
DEFAULT_TAG="nightly"

REGISTRY=${REGISTRY:-${DEFAULT_REGISTRY}}
ORGANIZATION=${ORGANIZATION:-${DEFAULT_ORGANIZATION}}
TAG=${TAG:-${DEFAULT_TAG}}

NAME_FORMAT="${REGISTRY}/${ORGANIZATION}"

PUSH_IMAGES=false
if [ "$1" == "--push" ]; then
PUSH_IMAGES=true
fi

while read -r line; do
base_image_name=$(echo "$line" | tr -s ' ' | cut -f 1 -d ' ')
base_image=$(echo "$line" | tr -s ' ' | cut -f 2 -d ' ')
echo "Building ${NAME_FORMAT}/${base_image_name}:${TAG} based on $base_image ..."
docker build -t "${NAME_FORMAT}/${base_image_name}:${TAG}" --build-arg FROM_IMAGE="$base_image" "${SCRIPT_DIR}"/
if ${PUSH_IMAGES}; then
echo "Pushing ${NAME_FORMAT}/${base_image_name}:${TAG}" to remote registry
docker push "${NAME_FORMAT}/${base_image_name}:${TAG}"
fi
done < "${SCRIPT_DIR}"/base_images
20 changes: 20 additions & 0 deletions arbitrary-users-patch/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Ensure $HOME exists when starting
if [ ! -d "${HOME}" ]; then
mkdir -p "${HOME}"
fi

# Setup $PS1 for a consistent and reasonable prompt
if [ -w "${HOME}" ] && [ ! -f "${HOME}"/.bashrc ]; then
echo "PS1='\s-\v \w \$ '" > "${HOME}"/.bashrc
fi

# Add current (arbitrary) user to /etc/passwd
if ! whoami &> /dev/null; then
if [ -w /etc/passwd ]; then
echo "${USER_NAME:-user}:x:$(id -u):0:${USER_NAME:-user} user:${HOME}:/bin/bash" >> /etc/passwd
fi
fi

exec "$@"
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
# SPDX-License-Identifier: EPL-2.0
#

docker build -t quay.io/openshiftio/che-devfile-registry:latest .
docker build -t quay.io/eclipse/che-devfile-registry:nightly .
26 changes: 26 additions & 0 deletions cico_build_ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#
# Copyright (c) 2012-2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

# Output command before executing
set -x

# Exit on error
set -e

SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd)
export SCRIPT_DIR

# shellcheck disable=SC1090
. "${SCRIPT_DIR}"/cico_functions.sh

load_jenkins_vars
install_deps
set_ci_tag
build_and_push
26 changes: 26 additions & 0 deletions cico_build_nightly.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#
# Copyright (c) 2012-2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

# Output command before executing
set -x

# Exit on error
set -e

SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd)
export SCRIPT_DIR

# shellcheck disable=SC1090
. "${SCRIPT_DIR}"/cico_functions.sh

load_jenkins_vars
install_deps
set_nightly_tag
build_and_push
26 changes: 26 additions & 0 deletions cico_build_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#
# Copyright (c) 2012-2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

# Output command before executing
set -x

# Exit on error
set -e

SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd)
export SCRIPT_DIR

# shellcheck disable=SC1090
. "${SCRIPT_DIR}"/cico_functions.sh

load_jenkins_vars
install_deps
set_release_tag
build_and_push
57 changes: 39 additions & 18 deletions cico_build.sh → cico_functions.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2012-2018 Red Hat, Inc.
# Copyright (c) 2012-2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
Expand All @@ -22,6 +22,8 @@ function load_jenkins_vars() {
DEVSHIFT_TAG_LEN \
QUAY_USERNAME \
QUAY_PASSWORD \
QUAY_ECLIPSE_CHE_USERNAME \
QUAY_ECLIPSE_CHE_PASSWORD \
JENKINS_URL \
GIT_BRANCH \
GIT_COMMIT \
Expand All @@ -44,47 +46,66 @@ function install_deps() {
git

service docker start

echo 'CICO: Dependencies installed'
}

function set_release_tag() {
# Let's obtain the tag based on the
# version defined in the 'VERSION' file
TAG=$(head -n 1 VERSION)
export TAG
}

function set_ci_tag() {
# Let's obtain the tag based on the
# git commit hash
TAG=$(echo "$GIT_COMMIT" | cut -c1-"${DEVSHIFT_TAG_LEN}")
export TAG
}

function set_nightly_tag() {
# Let's set the tag as nightly
export TAG="nightly"
}

function tag_push() {
local TARGET=$1
docker tag "${IMAGE}" "$TARGET"
docker push "$TARGET"
}

function deploy() {
function build_and_push() {
TARGET=${TARGET:-"centos"}
REGISTRY="quay.io"

if [ "$TARGET" == "rhel" ]; then
DOCKERFILE="Dockerfile.rhel"
ORGANIZATION="openshiftio"
IMAGE="rhel-che-devfile-registry"
else
DOCKERFILE="Dockerfile"
ORGANIZATION="eclipse"
IMAGE="che-devfile-registry"
# For pushing to quay.io 'eclipse' organization we need to use different credentials
QUAY_USERNAME=${QUAY_ECLIPSE_CHE_USERNAME}
QUAY_PASSWORD=${QUAY_ECLIPSE_CHE_PASSWORD}
fi

if [ -n "${QUAY_USERNAME}" ] && [ -n "${QUAY_PASSWORD}" ]; then
docker login -u "${QUAY_USERNAME}" -p "${QUAY_PASSWORD}" "${REGISTRY}"
else
echo "Could not login, missing credentials for the registry"
echo "Could not login, missing credentials for pushing to the '${ORGANIZATION}' organization"
fi

# Let's deploy
docker build -t ${IMAGE} -f ${DOCKERFILE} .

TAG=$(echo "$GIT_COMMIT" | cut -c1-"${DEVSHIFT_TAG_LEN}")

tag_push "${REGISTRY}/openshiftio/$IMAGE:$TAG"
tag_push "${REGISTRY}/openshiftio/$IMAGE:latest"
echo 'CICO: Image pushed, ready to update deployed app'
}
# Let's build and push arbitrary-user patched images only to 'eclipse' quay.io organization
# which is done as part of the 'centos' target execution
if [ "$TARGET" == "centos" ]; then
"${SCRIPT_DIR}"/arbitrary-users-patch/build_images.sh --push
echo "CICO: pushed '${TAG}' version of the arbitrary-user patched base images"
fi

function cico_setup() {
load_jenkins_vars;
install_deps;
# Let's build and push images to 'quay.io'
docker build -t ${IMAGE} -f ${DOCKERFILE} .
tag_push "${REGISTRY}/${ORGANIZATION}/${IMAGE}:${TAG}"
echo "CICO: '${TAG}' version of images pushed to '${REGISTRY}/${ORGANIZATION}' organization"
}
cico_setup
deploy
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# SPDX-License-Identifier: EPL-2.0
#

apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand All @@ -21,12 +21,9 @@ spec:
app: che-devfile-registry
strategy:
type: RollingUpdate
rollingParams:
intervalSeconds: 1
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
timeoutSeconds: 600
updatePeriodSeconds: 1
template:
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion deploy/kubernetes/che-devfile-registry/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# SPDX-License-Identifier: EPL-2.0
#

cheDevfileRegistryImage: quay.io/openshiftio/che-devfile-registry
cheDevfileRegistryImage: quay.io/eclipse/che-devfile-registry:nightly
cheDevfileRegistryImagePullPolicy: Always
cheDevfileRegistryMemoryLimit: 256Mi
#cheDevfileRegistryIngressSecretName: che-tls
Expand Down
Loading

0 comments on commit 5123de1

Please sign in to comment.