lib/buildkite/builder/pipeline.rb in buildkite-builder-2.3.0 vs lib/buildkite/builder/pipeline.rb in buildkite-builder-2.4.0
- old
+ new
@@ -49,14 +49,15 @@
# Upload the pipeline.
Tempfile.create(['pipeline', '.yml']) do |file|
file.sync = true
file.write(contents)
- logger.info '+++ :paperclip: Uploading pipeline.yml as artifact'
- Buildkite::Pipelines::Command.artifact!(:upload, file.path)
- logger.info '+++ :pipeline: Uploading pipeline'
- Buildkite::Pipelines::Command.pipeline!(:upload, file.path)
+ logger.info "+++ :pipeline: Uploading pipeline"
+ unless Buildkite::Pipelines::Command.pipeline!(:upload, file.path)
+ logger.info "Pipeline upload failed, saving as artifact…"
+ Buildkite::Pipelines::Command.artifact!(:upload, file.path)
+ end
logger.info "+++ :toolbox: Setting job meta-data to #{Buildkite.env.job_id.color(:yellow)}"
Buildkite::Pipelines::Command.meta_data!(:set, Builder::META_DATA.fetch(:job), Buildkite.env.job_id)
end
end
@@ -87,16 +88,11 @@
end
def upload_artifacts
return if artifacts.empty?
- logger.info "+++ :paperclip: Uploading #{artifacts.size.to_s.color(:yellow)} artifact#{'s' if artifacts.size != 1}"
-
- artifacts.each do |path|
- if File.exist?(path)
- Buildkite::Pipelines::Command.artifact!(:upload, path)
- end
- end
+ logger.info "+++ :paperclip: Uploading artifacts"
+ Buildkite::Pipelines::Command.artifact!(:upload, artifacts.join(";"))
end
def pipeline_definition
@pipeline_definition ||= load_definition(root.join(PIPELINE_DEFINITION_FILE), Definition::Pipeline)
end