Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve development flow with skaffold #869

Merged
merged 3 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ docker build . -f build/dockerfiles/Dockerfile -t quay.io/eclipse/che-dashboard:

To run Dashboard against Che Cluster you need access to Kubernetes cluster where it lives.
So, make sure kubeconfig from $KUBECONFIG (or if unset ~/.kube/config) has the target cluster as current.
If no - you may need to do oc login (if it's OpenShift) or modify it manually if it's Kubernetes.
If no - you may need to do `oc login` (if it's OpenShift) or modify it manually if it's Kubernetes.

Then you can proceed to the following steps:

```sh
Expand Down Expand Up @@ -195,6 +196,35 @@ To a new image and apply it to the CheCluster, run:
yarn build-and-patch
```

### Update dashboard on remote cluster using `skaffold.dev`

To update the dashboard deployment you need access to the Kubernetes cluster (see [Running locally against remote Che Cluster (Node.js v.16)](#running-locally-against-remote-che-cluster-nodejs-v16))

Then proceed with the following steps:

```sh
# export an environment variable to define a repository you want images to be pushed, e.g.:
export DEFAULT_REPO=quay.io/<project-id>
akurinnoy marked this conversation as resolved.
Show resolved Hide resolved
```

```sh
# and log in to the repository:
podman login quay.io
```

Now you can build the project and get the dashboard on the remote cluster updated:

```sh
# build the dashboard:
yarn build

# update the dashboard deployment once:
skaffold run --cleanup=false --default-repo=$DEFAULT_REPO

# or, run in development mode to watch for changes:
skaffold dev --cleanup=false --default-repo=$DEFAULT_REPO
```

## Branding

Default branding data for the User Dashboard is located in [branding.constant.ts](/packages/dashboard-frontend/src/services/bootstrap/branding.constant.ts)#BRANDING_DEFAULT. It can be overridden without re-building the project in [product.json](/packages/dashboard-frontend/assets/branding/product.json) file which should contain only values that should overwrite default ones.
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions build/dockerfiles/brew.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.git
.vscode
.idea
**/lib
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
**/node_modules/
9 changes: 9 additions & 0 deletions build/dockerfiles/rhel.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.git
.vscode
.idea
**/lib
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
**/node_modules/
27 changes: 27 additions & 0 deletions build/dockerfiles/skaffold.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (c) 2021 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
#
# Contributors:
# Red Hat, Inc. - initial API and implementation

FROM docker.io/node:16.16.0-alpine3.15

ENV FRONTEND_LIB=../../packages/dashboard-frontend/lib/public
ENV BACKEND_LIB=../../packages/dashboard-backend/lib
ENV DEVFILE_REGISTRY=../../packages/devfile-registry

COPY ${BACKEND_LIB} /backend
COPY ${FRONTEND_LIB} /public
COPY ${DEVFILE_REGISTRY} /public/dashboard/devfile-registry

COPY ../../build/dockerfiles/entrypoint.sh /entrypoint.sh

EXPOSE 80
EXPOSE 443

ENTRYPOINT [ "/entrypoint.sh" ]
CMD [ "sh" ]
2 changes: 1 addition & 1 deletion devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
components:
- name: tools
container:
image: quay.io/devfile/universal-developer-image:ubi8-38da5c2
image: quay.io/okurinny/dashboard.dev:skaffold
akurinnoy marked this conversation as resolved.
Show resolved Hide resolved
memoryLimit: 10G
memoryRequest: 512Mi
cpuRequest: 1000m
Expand Down
12 changes: 12 additions & 0 deletions k8s/devspaces.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: org.eclipse.che/v2
kind: CheCluster
metadata:
name: devspaces
namespace: openshift-operators
spec:
components:
dashboard:
deployment:
containers:
- image: che-dashboard
imagePullPolicy: Always
12 changes: 12 additions & 0 deletions k8s/eclipse-che.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: org.eclipse.che/v2
kind: CheCluster
metadata:
name: eclipse-che
namespace: eclipse-che
spec:
components:
dashboard:
deployment:
containers:
- image: che-dashboard
imagePullPolicy: Always
32 changes: 32 additions & 0 deletions skaffold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: skaffold/v4beta6
kind: Config
metadata:
name: che-dashboard
build:
tagPolicy:
sha256: {}
artifacts:
- image: che-dashboard
context: .
custom:
buildCommand: |
podman build --tag=$IMAGE -f build/dockerfiles/skaffold.Dockerfile . && podman push $IMAGE
akurinnoy marked this conversation as resolved.
Show resolved Hide resolved
dependencies:
paths:
- packages/*/lib/*
- packages/devfile-registry
resourceSelector:
allow:
- groupKind: 'CheCluster.org.eclipse.che'
image: ['.*']
manifests:
rawYaml:
- k8s/eclipse-che.yaml

profiles:
- name: eclipse-che
- name: devspaces
patches:
- op: replace
path: /manifests/rawYaml/0
value: k8s/devspaces.yaml