Jump to content

Partial workspace update with Windows Batch command

Recommended Posts

Hi there!

I'm not sure if I'm approaching this in the right way, but would appreciate any feedback regarding my process.

I have a dedicated build server with Jenkins installed that has a Plastic user associated with it, and am attempting to run nightly Unity builds and keeping a local partial workspace up to date using the following Windows batch command:

cd /d d:\plastic\projects
cm partial configure +/%PROJECT_NAME%/WebGL --ignorefailed
cm partial update /%PROJECT_NAME%/WebGL

However this seems to be getting itself into a very confused/tangled state (or maybe it's me in the very confused state...?) after new items are committed by other users.

If I check status, I can see a couple of files checked-out, however when I try to undo checked out items I get:
"The object is currently locked. Try later. Workspace: 'd:\plastic\projects'."

If I try to update the workspace:
"Access to the path [workspace]\.plastic\plastic.wktree is denied"

My two questions are:
1. How do I get out of this loop that I'm stuck in? I can't undo checkouts, and I can't update. I can't even delete the workspace directory and start again...
2. What am I doing wrong to get myself into this bind? Should I approach updating a partial workspace in a different way?

Thanks in advance for any help

Share this post

Link to post
Share on other sites

Are you relying on Jenkins directly-or-indirectly running those lines of code? If so, the Jenkins agent runs as SYSTEM ... but your Remote Desktop session runs as Fleer. When Jenkins runs Plastic, Plastic will fetch files and create these files with owner SYSTEM. Later on, when you attempt to touch the same workspace via Plastic via the Remote Desktop session, Plastic complains that it can't touch any of the files in the workspace because of ownership/permissions problems.

In order to get away from this, either make Jenkins use the same user as yourself (so you can use Plastic via Remote Desktop against the same workspace), or make Jenkins run the cleanup commands.


What I have done is, I'm letting the Plastic plugin perform full checkout of the repo (so no explicit "cm partial ..." commands), and as a post step in the (declarative) pipeline I run the following:

cm unco --all ${WORKSPACE}

This undoes all actions that Unity may have caused except for one thing: it will not remove newly added files. If you want to delete those, you need to write more logic of your own to find & delete those.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now