Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run this plugin from the new Pipeline script in Jenkins v2? #8

Open
strich opened this issue Jun 12, 2016 · 11 comments
Open

How to run this plugin from the new Pipeline script in Jenkins v2? #8

strich opened this issue Jun 12, 2016 · 11 comments

Comments

@strich
Copy link

strich commented Jun 12, 2016

As the title says - Would be good to see an example of how to run this plugin from the Pipeline script.

@JohannSig
Copy link

Seconded

@brockhjones
Copy link

It seems like this plugin may be abandoned - no commits in 2 years. Without proper pipeline support it's not really very useful any more.

@JohannSig
Copy link

I went full command line (sh/bat) instead. Works, but doesn't pipe the log file into the results like the plugin did. Ah, well

@garyritchie
Copy link

Looks like efforts are being focused on https://github.com/DragonBox/u3d

@The-Arrival
Copy link

@JohannSig is it possible to get some of you bash commands as an example? I´m struggeling finding info on how to execute Buildscripts via pipeline build files

@JohannSig
Copy link

@The-Arrival - It's been a while now, and I've basically moved us away from an all-in-one pipeline script to one that calls parameterized sub-tasks, like so:

stage('Compile Client') {
			steps {
				lock("Unity3d2017") {
					build(job : "Compile Client", parameters: [
						string(name: "BRANCH_NAME", value: env.BRANCH_NAME),
						string(name: "BUILD_TARGET", value: env.BUILD_TARGET)
						] );
				}
			}
		}

.. where Compile Client is a Jenkins Task utilizing the Unity3D plugin. This introduced other complications at the time (possible executor deadlocks) but today I find this setup much cleaner and more appealing to the rest of the team than the groovy porridge I kept trying to force-feed them 8-)

@JohannSig
Copy link

JohannSig commented Jul 20, 2018

.. for the sake of complete info though, here are the arguments used by my "Invoke Unity3D Editor" build step when running my "Compile Client" build task:

Unity3D.exe -buildTarget Win -projectPath ${WORKSPACE} -quit -batchmode -executeMethod CommandLineHelper.GenerateCSharpProjects -logFile ${WORKSPACE}\Unity3dLog.txt

.. where CommandLineHelper's humble purpose is to make Unity spit out new .csproj files:

using UnityEditor;

public class CommandLineHelper
{

    public static void GenerateCSharpProjects()
    {
        EditorApplication.ExecuteMenuItem("Assets/Open C# Project");
    }

}

I'm fairly sure you can copy these steps with ease if you need them.

@rysenko
Copy link

rysenko commented Jul 26, 2018

@JohannSig @The-Arrival If you want to redirect editor output to STDOUT, just specify empty -logFile. This works perfectly for me: /Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -projectPath $WORKSPACE -executeMethod BuildClass.BuildMethod -logFile.

@leechunkit
Copy link

@rysenko yup, it works for OSX and Linux. not for Windows though.

https://docs.unity3d.com/Manual/CommandLineArguments.html

@yuchting
Copy link

yuchting commented Apr 23, 2021

Leaving a empty "-logfile" doesn't work now, the official document writes:

-logFile
Specify where Unity writes the Editor or Windows/Linux/OSX standalone log file. To output to the console, specify - for the path name. On Windows, specify - option to make the output go to stdout, which is not the console by default.

so you need to append a minus sign after "-logfile":
"-logfile -"

@haiya512
Copy link

image
how can i rewrite this unity3d plugin job with pipeline ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants