@Test public void simpleAgentDockerfile() throws Exception { AgentDirective agent = new AgentDirective(new DockerPipelineFromDockerfile()); assertGenerateDirective(agent, "agent {\n" + " dockerfile true\n" + "}"); }
@Test public void agentNone() throws Exception { AgentDirective agent = new AgentDirective(new None()); assertGenerateDirective(agent, "agent none"); }
@Test public void simpleAgentDocker() throws Exception { AgentDirective agent = new AgentDirective(new DockerPipeline("some-image")); assertGenerateDirective(agent, "agent {\n" + " docker 'some-image'\n" + "}"); }
@Test public void agentLabel() throws Exception { AgentDirective agent = new AgentDirective(new Label("some-label")); assertGenerateDirective(agent, "agent {\n" + " label 'some-label'\n" + "}"); }
@Test public void agentAny() throws Exception { AgentDirective agent = new AgentDirective(new Any()); assertGenerateDirective(agent, "agent any"); }
nested.add(new BranchConditional("this-branch")); WhenDirective when = new WhenDirective(new AllOfConditional(nested), false); AgentDirective agent = new AgentDirective(new DockerPipeline("some-image"));
@Test public void fullAgentDockerfile() throws Exception { DockerPipelineFromDockerfile dp = new DockerPipelineFromDockerfile(); dp.setAdditionalBuildArgs("--additional-arg"); dp.setDir("some-sub/dir"); dp.setFilename("NotDockerfile"); dp.setArgs("--some-arg"); dp.setCustomWorkspace("/custom/workspace"); dp.setLabel("some-label"); AgentDirective agent = new AgentDirective(dp); assertGenerateDirective(agent, "agent {\n" + " dockerfile {\n" + " additionalBuildArgs '--additional-arg'\n" + " args '--some-arg'\n" + " customWorkspace '/custom/workspace'\n" + " dir 'some-sub/dir'\n" + " filename 'NotDockerfile'\n" + " label 'some-label'\n" + " }\n" + "}"); }
@Test public void fullAgentDocker() throws Exception { DockerPipeline dockerPipeline = new DockerPipeline("some-image"); dockerPipeline.setAlwaysPull(true); dockerPipeline.setArgs("--some-arg"); dockerPipeline.setCustomWorkspace("some/path"); dockerPipeline.setLabel("some-label"); dockerPipeline.setRegistryCredentialsId("some-cred-id"); dockerPipeline.setReuseNode(true); dockerPipeline.setRegistryUrl("http://some.where"); AgentDirective agent = new AgentDirective(dockerPipeline); assertGenerateDirective(agent, "agent {\n" + " docker {\n" + " alwaysPull true\n" + " args '--some-arg'\n" + " customWorkspace 'some/path'\n" + " image 'some-image'\n" + " label 'some-label'\n" + " registryCredentialsId 'some-cred-id'\n" + " registryUrl 'http://some.where'\n" + " reuseNode true\n" + " }\n" + "}"); }