Sha256: a7577506e32ce40fee332fb97c71b347caec37eaa35ac70257f9ca016ecea74e

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

module Pipedream::Dsl::Pipeline
  module Codebuild
    def codebuild(*projects)
      default = {
        # name: '', # will be set
        action_type_id: {
          category: "Build",
          owner: "AWS",
          provider: "CodeBuild",
          version: "1",
        },
        run_order: @run_order,
        # configuration: { project_name: '' }, # will be set
        # output_artifacts: [name: "BuildArtifact#{name}"], # TODO: maybe make this configurable with a setting
        input_artifacts: [name: "SourceArtifact"],
      }

      actions = projects.map do |item|
        if item.is_a?(String)
          name = item.underscore.camelize
          default.deep_merge(
            name: name,
            configuration: { project_name: name },
          )
        else # Hash
          # With the hash notation, user needs to set: name and project_name
          #
          #   codebuild(name: "action-name", project_name: "codebuild-project-names")
          #
          project_name = item.delete(:project_name)
          if project_name
            item[:configuration] = { project_name: project_name }
          end

          item.reverse_merge(default)
        end
      end

      action(*actions)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pipedream-0.4.4 lib/pipedream/dsl/pipeline/codebuild.rb
pipedream-0.4.3 lib/pipedream/dsl/pipeline/codebuild.rb