Skip to content

Commit

Permalink
Create go 1.19 stack versions (#239)
Browse files Browse the repository at this point in the history
* Deprecate go 1.18 stack versions

Signed-off-by: thepetk <[email protected]>

* Create stack version 3.0.0

Signed-off-by: thepetk <[email protected]>

* Create the 3.1.0 go stack version

Signed-off-by: thepetk <[email protected]>

* Finalize versioning

Signed-off-by: thepetk <[email protected]>

* Add debugging to go 1.2.0

Signed-off-by: thepetk <[email protected]>

* Remove deprecated from 1.2.0

Signed-off-by: thepetk <[email protected]>

* Add comment on default

Signed-off-by: thepetk <[email protected]>

* Exclude golang deprecated stacks from renovate

Signed-off-by: thepetk <[email protected]>

---------

Signed-off-by: thepetk <[email protected]>
  • Loading branch information
thepetk authored Nov 8, 2023
1 parent 99da1e4 commit 2af4087
Show file tree
Hide file tree
Showing 10 changed files with 246 additions and 2 deletions.
6 changes: 5 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@
"stacks/java-openliberty-gradle/**",
"stacks/java-websphereliberty/**",
"stacks/java-websphereliberty-gradle/**",
"stacks/nodejs/**"
"stacks/nodejs/**",
"stacks/go/1.0.2/**",
"stacks/go/1.1.0/**",
"stacks/go/2.0.0/**",
"stacks/go/2.1.0/**"
],
"prHourlyLimit": 20,
"prConcurrentLimit": 5
Expand Down
1 change: 1 addition & 0 deletions stacks/go/1.0.2/devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
icon: https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg
tags:
- Go
- Deprecated
projectType: Go
language: Go
provider: Red Hat
Expand Down
1 change: 1 addition & 0 deletions stacks/go/1.1.0/devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
icon: https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg
tags:
- Go
- Deprecated
projectType: Go
language: Go
provider: Red Hat
Expand Down
76 changes: 76 additions & 0 deletions stacks/go/1.2.0/devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
schemaVersion: 2.1.0
metadata:
name: go
displayName: Go Runtime
description: Go (version 1.19.x) is an open source programming language that makes it easy to build simple, reliable, and efficient software.
icon: https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg
tags:
- Go
projectType: Go
language: Go
provider: Red Hat
version: 1.2.0
starterProjects:
- name: go-starter
description: A Go project with a simple HTTP server
git:
checkoutFrom:
revision: main
remotes:
origin: https://github.com/devfile-samples/devfile-stack-go.git
components:
- container:
endpoints:
- name: http-go
targetPort: 8080
- exposure: none
name: debug
targetPort: 5858
image: registry.access.redhat.com/ubi9/go-toolset:1.19.13-4.1697647145
args: ["tail", "-f", "/dev/null"]
env:
- name: DEBUG_PORT
value: '5858'
memoryLimit: 1024Mi
mountSources: true
name: runtime
commands:
- exec:
env:
- name: GOPATH
value: ${PROJECT_SOURCE}/.go
- name: GOCACHE
value: ${PROJECT_SOURCE}/.cache
commandLine: go build main.go
component: runtime
group:
isDefault: true
kind: build
workingDir: ${PROJECT_SOURCE}
id: build
- exec:
commandLine: ./main
component: runtime
group:
isDefault: true
kind: run
workingDir: ${PROJECT_SOURCE}
id: run

- exec:
commandLine: |
GOPATH=${PROJECT_SOURCE}/.go \
GOCACHE=${PROJECT_SOURCE}/.cache \
dlv \
--listen=127.0.0.1:${DEBUG_PORT} \
--only-same-user=false \
--headless=true \
--api-version=2 \
--accept-multiclient \
debug --continue main.go
component: runtime
group:
isDefault: true
kind: debug
workingDir: ${PROJECT_SOURCE}
id: debug
1 change: 1 addition & 0 deletions stacks/go/2.0.0/devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
icon: https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg
tags:
- Go
- Deprecated
projectType: Go
language: Go
provider: Red Hat
Expand Down
1 change: 1 addition & 0 deletions stacks/go/2.1.0/devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
icon: https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg
tags:
- Go
- Deprecated
projectType: Go
language: Go
provider: Red Hat
Expand Down
103 changes: 103 additions & 0 deletions stacks/go/2.2.0/devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
schemaVersion: 2.2.0
metadata:
name: go
displayName: Go Runtime
description: Go (version 1.19.x) is an open source programming language that makes it easy to build simple, reliable, and efficient software.
icon: https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg
tags:
- Go
projectType: Go
language: Go
provider: Red Hat
version: 2.2.0
starterProjects:
- name: go-starter
description: A Go project with a simple HTTP server
git:
checkoutFrom:
revision: main
remotes:
origin: https://github.com/devfile-samples/devfile-stack-go.git
components:
- name: build
image:
imageName: go-image:latest
dockerfile:
uri: docker/Dockerfile
buildContext: .
rootRequired: false
- name: deploy
kubernetes:
uri: kubernetes/deploy.yaml
endpoints:
- name: http-8081
targetPort: 8081
- container:
endpoints:
- name: http-go
targetPort: 8080
- exposure: none
name: debug
targetPort: 5858
image: registry.access.redhat.com/ubi9/go-toolset:1.19.13-4.1697647145
args: ['tail', '-f', '/dev/null']
env:
- name: DEBUG_PORT
value: '5858'
memoryLimit: 1024Mi
mountSources: true
name: runtime
commands:
- id: build-image
apply:
component: build
- id: deployk8s
apply:
component: deploy
- id: deploy
composite:
commands:
- build-image
- deployk8s
group:
kind: deploy
isDefault: true
- exec:
env:
- name: GOPATH
value: ${PROJECT_SOURCE}/.go
- name: GOCACHE
value: ${PROJECT_SOURCE}/.cache
commandLine: go build main.go
component: runtime
group:
isDefault: true
kind: build
workingDir: ${PROJECT_SOURCE}
id: build
- exec:
commandLine: ./main
component: runtime
group:
isDefault: true
kind: run
workingDir: ${PROJECT_SOURCE}
id: run

- exec:
commandLine: |
GOPATH=${PROJECT_SOURCE}/.go \
GOCACHE=${PROJECT_SOURCE}/.cache \
dlv \
--listen=127.0.0.1:${DEBUG_PORT} \
--only-same-user=false \
--headless=true \
--api-version=2 \
--accept-multiclient \
debug --continue main.go
component: runtime
group:
isDefault: true
kind: debug
workingDir: ${PROJECT_SOURCE}
id: debug
12 changes: 12 additions & 0 deletions stacks/go/2.2.0/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM registry.access.redhat.com/ubi9/go-toolset:1.19.13-4.1697647145

COPY go.mod ./
RUN go mod download

COPY *.go ./

RUN go build -o ./main

EXPOSE 8081

CMD [ "./main" , "-p=8081"]
41 changes: 41 additions & 0 deletions stacks/go/2.2.0/kubernetes/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
kind: Service
apiVersion: v1
metadata:
name: my-go-svc
spec:
ports:
- name: http-8081
port: 8081
protocol: TCP
targetPort: 8081
selector:
app: go-app
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: my-go
spec:
replicas: 1
selector:
matchLabels:
app: go-app
template:
metadata:
labels:
app: go-app
spec:
containers:
- name: my-go
image: go-image:latest
ports:
- name: http
containerPort: 8081
protocol: TCP
resources:
requests:
memory: "10Mi"
cpu: "10m"
limits:
memory: "100Mi"
cpu: "100m"
6 changes: 5 additions & 1 deletion stacks/go/stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ displayName: Go Runtime
icon: https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg
versions:
- version: 1.0.2
default: true # should have one and only one default version
# 1.1.0: debug command via dlv
- version: 1.1.0
# 1.2.0: debug command via dlv & go 1.19
- version: 1.2.0
default: true # should have one and only one default version
- version: 2.0.0
# 2.1.0: debug command via dlv
- version: 2.1.0
# 2.2.0: debug command via dlv & go 1.19
- version: 2.2.0

0 comments on commit 2af4087

Please sign in to comment.