#1484  JOB_WORKSPACE should be ONEDEV_WORKSPACE in run container step help
Released
doubleplusc opened 9 months ago

I am extremely new to Docker so apologies if I am missing something obvious.

My OneDev instance is running in a Docker container. I have a set of published artifacts in the job workspace that I want to process in another Docker container. That container starts inside the home directory.

I don't quite understand how to use the environment variable JOB_WORKSPACE as explained in the Run Docker Container step type. I cannot use @JOB_WORKSPACE@, ${JOB_WORKSPACE}, or $JOB_WORKSPACE in Working Directory. Is the variable supposed to be manually set or referenced in a different way?

Robin Shen commented 9 months ago

You may use job dependency to retrieve published artifacts of another job into workspace of current job.

Robin Shen commented 9 months ago
doubleplusc commented 9 months ago

Thanks for your response, Robin. Much headbanging later, I sort of figured out the issue.

In the second job, my container default directory is /. For debug purposes I have a bash container that runs ls. I have to go into /onedev-build/workspace to access the artifacts.

My question is now a little different. For running separate Docker containers, is putting /onedev-build/workspace as the working directory the expectation? Where does the env var JOB_WORKSPACE tie into all of this? The note at the top is somewhat misleading if setting the proper working directory has nothing to do with JOB_WORKSPACE.

i.imgur.com/LdZKz5O.png

Robin Shen commented 9 months ago

Sorry there is a mistake here. The environment varibale should be ONEDEV_WORKSPACE instead of JOB_WORKSPACE here. It points to /onedev-build/workspace which will always be mounted to contain job workspace files (shared with other steps).

Another approach is to mount the job workspace into your container via volume mounts. To mount job workspace itself, specify the source path as .

Robin Shen changed fields 9 months ago
Name Previous Value Current Value
Type
Support Request
Bug
Affected Versions
empty
<=8.6.2
Robin Shen changed title 9 months ago
Previous Value Current Value
Using JOB_WORKSPACE in Run Docker Containers step
JOB_WORKSPACE should be ONEDEV_WORKSPACE in run container step help
Robin Shen changed fields 9 months ago
Name Previous Value Current Value
Affected Versions
<=8.6.2
<=8.6.3
Robin Shen changed fields 9 months ago
Name Previous Value Current Value
Priority
Normal
Minor
doubleplusc commented 9 months ago

Awesome, thanks for looking into it!

OneDev changed state to 'Closed' 9 months ago
Previous Value Current Value
Open
Closed
OneDev commented 9 months ago

State changed as code fixing the issue is committed (94979a94)

OneDev changed state to 'Released' 9 months ago
Previous Value Current Value
Closed
Released
OneDev commented 9 months ago

State changed as build #3946 is successful

issue 1 of 1
Type
Bug
Priority
Minor
Assignee
Affected Versions
<=8.6.3
Labels
No labels
Issue Votes (0)
Watchers (4)
Reference
onedev/server#1484
Please wait...
Page is in error, reload to recover