lib/buildkite/builder/pipeline.rb in buildkite-builder-2.2.0 vs lib/buildkite/builder/pipeline.rb in buildkite-builder-2.3.0
- old
+ new
@@ -39,23 +39,27 @@
use(Extensions::Steps)
load_manifests
end
def upload
+ # Generate the pipeline YAML first.
+ contents = to_yaml
+
+ upload_artifacts
+
# Upload the pipeline.
Tempfile.create(['pipeline', '.yml']) do |file|
file.sync = true
- file.write(to_yaml)
+ 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 "+++ :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
-
- logger.info '+++ :paperclip: Uploading artifacts'
- upload_artifacts
end
def to_h
@pipeline_hash ||= begin
results = benchmark("\nDone (%s)".color(:springgreen)) do
@@ -82,9 +86,11 @@
end
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