che
che copied to clipboard
Failed to run `go build` task, env var is not taking into account
Describe the bug
Failed to run go build task from the devfile below:
schemaVersion: 2.2.0
metadata:
name: go
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:
image: registry.access.redhat.com/ubi9/go-toolset:1.19.13-4.1697647145
args: ["tail", "-f", "/dev/null"]
memoryLimit: 1024Mi
mountSources: true
name: runtime
commands:
- exec:
env:
- name: GOPATH
value: /projects/go-starter/.go
- name: GOCACHE
value: /projects/go-stater/.cache
commandLine: echo "GOCACHE=$GOCACHE" && go build main.go
component: runtime
group:
isDefault: true
kind: build
workingDir: /projects/go-starter
id: build
The output:
* Executing task: devfile: build
GOCACHE=/projects/go-stater/.cache
failed to initialize build cache at /opt/app-root/src/.cache/go-build: mkdir /opt/app-root/src/.cache: permission denied
* The terminal process failed to launch (exit code: 1).
Meanwhile, this commands runs successfully:
commandLine: echo "GOCACHE=$GOCACHE" && export GOCACHE=/projects/go-stater/.cache && go build main.go
Che version
next (development version)
Steps to reproduce
- Create a workspace from the devfile above
- Run
buildtask
Expected behavior
Command run successfully
Runtime
OpenShift
Screenshots
No response
Installation method
chectl/next
Environment
Linux
Eclipse Che Logs
No response
Additional context
No response