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

feat: add basic devfile and vscode settings to the repo #459

Open
wants to merge 7 commits into
base: devspaces-3-rhel-8
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
21 changes: 21 additions & 0 deletions .devfile.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) 2023 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

# This container featres tools required for Devspaces Images
FROM quay.io/devfile/universal-developer-image:ubi8-latest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is something you want to see built downstream, you aren't allowed to use FROM quay.io in OSBS.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this image is not needed to be built downstream. It's only used as a tooling container, when this workspace will be used in Che/Devspaces


#install Go 1.18 (needed to work with devspaces-operator)
RUN cd /tmp && wget https://go.dev/dl/go1.18.6.linux-amd64.tar.gz && \
mkdir $HOME/go1.18 && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we update this to go 1.20 since that's what we're using downstream?

tar -xvzf go1.18.6.linux-amd64.tar.gz -C $HOME/go1.18 --strip-components 1 && \
if ! grep -q "export PATH=\$HOME/go1.18/bin:\$PATH" $HOME/.bashrc; then echo "export PATH=\$HOME/go1.18/bin:\$PATH" >> $HOME/.bashrc; fi

# install goimports (needed to work with devspaces-operator)
RUN $HOME/go1.18/bin/go install golang.org/x/tools/cmd/goimports@latest
49 changes: 49 additions & 0 deletions .github/workflows/devfile-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
# Copyright (c) 2023 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
#

name: Devfile image CI

on:
push:
branches:
- 'main'
paths:
- '.devfile.Dockerfile'

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
-
name: Build and push container
uses: docker/build-push-action@v4
with:
context: .
file: .devfile.Dockerfile
push: true
tags: quay.io/devspaces/devspaces-images-dev:latest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be :next if it's CI?

6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"rogalmic.bash-debug",
"redhat.vscode-yaml"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about golang/vscode-go

]
}
11 changes: 11 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "bashdb",
"request": "launch",
"name": "Bash-Debug (simplest configuration)",
"program": "${file}"
}
]
}
43 changes: 43 additions & 0 deletions devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# Copyright (c) 2023 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
#
schemaVersion: 2.2.0
metadata:
name: devspaces-images
components:
- name: tools
container:
image: quay.io/devfile/universal-developer-image:ubi8-latest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you using the upstream UDI image in a devfile for the downstream UDI image?

memoryRequest: 1Gi
memoryLimit: 8Gi
cpuLimit: '4'
cpuRequest: '0.5'
commands:
#devspaces-operator
- id: operator-go-build
exec:
label: Build Eclipse Che Operator binary
component: tooling-container
commandLine: make build
workingDir: ${PROJECT_SOURCE}/devspaces-operator
- id: operator-go-run
exec:
label: Run Eclipse Che Operator
component: tooling-container
commandLine: make run
workingDir: ${PROJECT_SOURCE}/devspaces-operator
- id: operator-go-test
exec:
label: Run unit tests
component: tooling-container
commandLine: make test
workingDir: ${PROJECT_SOURCE}/devspaces-operator
#devspaces-operator-bundle
24 changes: 22 additions & 2 deletions devspaces-operator/devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ schemaVersion: 2.1.0
attributes:
controller.devfile.io/storage-type: ephemeral
metadata:
name: che-operator
name: devspaces-images
components:
- name: tooling-container
container:
Expand All @@ -34,6 +34,22 @@ components:
- name: KUBECONFIG
value: /home/user/.kube/config
commands:
- id: install-chectl
exec:
label: POST START EVENT - Install chectl
component: tooling-container
commandLine: |
tag=$(curl https://api.github.com/repos/che-incubator/chectl/tags | jq -r '.[0].name') && \
cd /tmp && wget https://github.com/che-incubator/chectl/releases/download/${tag}/chectl-linux-x64.tar.gz && \
mkdir $HOME/chectl && \
tar -xvzf chectl-linux-x64.tar.gz -C $HOME/chectl --strip-components 1 && \
if ! grep -q "export PATH=\$HOME/chectl/bin:\$PATH" $HOME/.bashrc; then echo "export PATH=\$HOME/chectl/bin:\$PATH" >> $HOME/.bashrc; fi
- id: install-goimports
exec:
label: POST START EVENT - Install goimports
component: tooling-container
commandLine: |
go install golang.org/x/tools/cmd/goimports@latest
- id: go-build
exec:
label: Build Eclipse Che Operator binary
Expand All @@ -58,4 +74,8 @@ commands:
exec:
label: Update all development resources
component: tooling-container
commandLine: make update-dev-resources
commandLine: make update-dev-resources
events:
postStart:
- install-goimports
- install-chectl