コード例 #1
0
    def __enter__(self):
        try:
            start_go_server(self.gocd_version,
                            self.gocd_download_version_string)

            configurator = GoCdConfigurator(HostRestClient('localhost:8153'))
            pipeline = configurator \
                .ensure_pipeline_group("P.Group") \
                .ensure_replacement_of_pipeline("more-options") \
                .set_timer("0 15 22 * * ?") \
                .set_git_material(GitMaterial("https://github.com/SpringerSBM/gomatic.git", material_name="some-material-name", polling=False)) \
                .ensure_environment_variables({'JAVA_HOME': '/opt/java/jdk-1.7'}) \
                .ensure_parameters({'environment': 'qa'})
            stage = pipeline.ensure_stage("earlyStage")
            job = stage.ensure_job("earlyWorm").ensure_artifacts({
                Artifact.get_build_artifact("scripts/*", "files"),
                Artifact.get_build_artifact("target/universal/myapp*.zip",
                                            "artifacts"),
                Artifact.get_test_artifact("from", "to")
            }).set_runs_on_all_agents()
            job.add_task(ExecTask(['ls']))

            configurator.save_updated_config(save_config_locally=True)
            return GoCdConfigurator(HostRestClient('localhost:8153'))
        except:
            # Swallow exception if __exit__ returns a True value
            if self.__exit__(*sys.exc_info()):
                pass
            else:
                raise
コード例 #2
0
ファイル: integration_test.py プロジェクト: compwron/gomatic
    def __enter__(self):
        try:
            start_go_server(self.gocd_version)

            configurator = GoCdConfigurator(HostRestClient('localhost:8153'))
            pipeline = configurator \
                .ensure_pipeline_group("P.Group") \
                .ensure_replacement_of_pipeline("more-options") \
                .set_timer("0 15 22 * * ?") \
                .set_git_material(GitMaterial("https://github.com/SpringerSBM/gomatic.git", material_name="some-material-name", polling=False)) \
                .ensure_environment_variables({'JAVA_HOME': '/opt/java/jdk-1.7'}) \
                .ensure_parameters({'environment': 'qa'})
            stage = pipeline.ensure_stage("earlyStage")
            job = stage.ensure_job("earlyWorm").ensure_artifacts(
                {Artifact.get_build_artifact("scripts/*", "files"),
                 Artifact.get_build_artifact("target/universal/myapp*.zip", "artifacts"),
                 Artifact.get_test_artifact("from", "to")}).set_runs_on_all_agents()
            job.add_task(ExecTask(['ls']))

            configurator.save_updated_config(save_config_locally=True)
            return GoCdConfigurator(HostRestClient('localhost:8153'))
        except:
            # Swallow exception if __exit__ returns a True value
            if self.__exit__(*sys.exc_info()):
                pass
            else:
                raise
コード例 #3
0
 def test_all_versions(self):
     for gocd_version, gocd_download_version_string in self.gocd_versions:
         print 'test_all_versions', "*" * 60, gocd_version
         with populated_go_server(
                 gocd_version,
                 gocd_download_version_string) as configurator:
             self.assertEquals(
                 ["P.Group"],
                 [p.name for p in configurator.pipeline_groups])
             self.assertEquals(["more-options"], [
                 p.name for p in configurator.pipeline_groups[0].pipelines
             ])
             pipeline = configurator.pipeline_groups[0].pipelines[0]
             self.assertEquals("0 15 22 * * ?", pipeline.timer)
             self.assertEquals(
                 GitMaterial("https://github.com/SpringerSBM/gomatic.git",
                             material_name="some-material-name",
                             polling=False), pipeline.git_material)
             self.assertEquals({'JAVA_HOME': '/opt/java/jdk-1.7'},
                               pipeline.environment_variables)
             self.assertEquals({'environment': 'qa'}, pipeline.parameters)
             self.assertEquals(['earlyStage'],
                               [s.name for s in pipeline.stages])
             self.assertEquals(['earlyWorm'],
                               [j.name for j in pipeline.stages[0].jobs])
             job = pipeline.stages[0].jobs[0]
             self.assertEquals(
                 {
                     Artifact.get_build_artifact("scripts/*", "files"),
                     Artifact.get_build_artifact(
                         "target/universal/myapp*.zip", "artifacts"),
                     Artifact.get_test_artifact("from", "to")
                 }, job.artifacts)
             self.assertEquals(True, job.runs_on_all_agents)
             self.assertEquals([ExecTask(['ls'])], job.tasks)
コード例 #4
0
ファイル: integration_test.py プロジェクト: compwron/gomatic
 def test_all_versions(self):
     for gocd_version in self.gocd_versions:
         print 'test_all_versions', "*" * 60, gocd_version
         with populated_go_server(gocd_version) as configurator:
             self.assertEquals(["P.Group"], [p.name for p in configurator.pipeline_groups])
             self.assertEquals(["more-options"], [p.name for p in configurator.pipeline_groups[0].pipelines])
             pipeline = configurator.pipeline_groups[0].pipelines[0]
             self.assertEquals("0 15 22 * * ?", pipeline.timer)
             self.assertEquals(GitMaterial("https://github.com/SpringerSBM/gomatic.git", material_name="some-material-name", polling=False),
                               pipeline.git_material)
             self.assertEquals({'JAVA_HOME': '/opt/java/jdk-1.7'}, pipeline.environment_variables)
             self.assertEquals({'environment': 'qa'}, pipeline.parameters)
             self.assertEquals(['earlyStage'], [s.name for s in pipeline.stages])
             self.assertEquals(['earlyWorm'], [j.name for j in pipeline.stages[0].jobs])
             job = pipeline.stages[0].jobs[0]
             self.assertEquals({Artifact.get_build_artifact("scripts/*", "files"), Artifact.get_build_artifact("target/universal/myapp*.zip", "artifacts"), Artifact.get_test_artifact("from", "to")},
                               job.artifacts)
             self.assertEquals(True, job.runs_on_all_agents)
             self.assertEquals([ExecTask(['ls'])], job.tasks)