feat: Add customized container for Devfile (#1753)

---------

Signed-off-by: Mykhailo Kuznietsov <mkuznets@redhat.com>
Co-authored-by: Mario Loriedo <mario.loriedo@gmail.com>
pull/1755/head
Mykhailo Kuznietsov 2023-09-19 17:03:33 +03:00 committed by GitHub
parent 328a2dff18
commit 5d702069dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 70 additions and 36 deletions

17
.devfile.Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM quay.io/devfile/universal-developer-image:ubi8-latest
#install Go 1.18
RUN cd /tmp && wget https://go.dev/dl/go1.18.6.linux-amd64.tar.gz && \
mkdir $HOME/go1.18 && \
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 chectl
RUN 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
# install goimports
RUN $HOME/go1.18/bin/go install golang.org/x/tools/cmd/goimports@latest

49
.github/workflows/devfile-ci.yaml vendored Normal file
View File

@ -0,0 +1,49 @@
#
# Copyright (c) 2019-2022 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: 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/eclipse/che-operator-dev:latest

View File

@ -77,7 +77,7 @@ metadata:
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation
name: eclipse-che.v7.74.0-809.next
name: eclipse-che.v7.75.0-809.next
namespace: placeholder
spec:
apiservicedefinitions: {}
@ -1234,7 +1234,7 @@ spec:
minKubeVersion: 1.19.0
provider:
name: Eclipse Foundation
version: 7.74.0-809.next
version: 7.75.0-809.next
webhookdefinitions:
- admissionReviewVersions:
- v1

View File

@ -17,7 +17,7 @@ metadata:
components:
- name: tooling-container
container:
image: quay.io/devfile/universal-developer-image:ubi8-latest
image: quay.io/eclipse/che-operator-dev:latest
memoryRequest: 2Gi
memoryLimit: 16Gi
cpuRequest: 2000m
@ -34,31 +34,6 @@ components:
- name: KUBECONFIG
value: /home/user/.kube/config
commands:
- id: install-go-1-18
exec:
label: POST START EVENT - Install go 1.18
component: tooling-container
commandLine: |
cd /tmp && wget https://go.dev/dl/go1.18.6.linux-amd64.tar.gz && \
mkdir $HOME/go1.18 && \
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
- 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: |
$HOME/go1.18/bin/go install golang.org/x/tools/cmd/goimports@latest
- id: go-build
exec:
label: Build Eclipse Che Operator binary
@ -83,11 +58,4 @@ commands:
exec:
label: Update all development resources
component: tooling-container
commandLine: make update-dev-resources
events:
postStart:
- install-go-1-18
- install-goimports
- install-chectl
commandLine: make update-dev-resources