Class: SupplyChain::Slsa::ProvenanceStatement::RunDetails

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
app/models/supply_chain/slsa/provenance_statement.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#builderObject

Returns the value of attribute builder.



82
83
84
# File 'app/models/supply_chain/slsa/provenance_statement.rb', line 82

def builder
  @builder
end

#byproductsObject

Returns the value of attribute byproducts.



82
83
84
# File 'app/models/supply_chain/slsa/provenance_statement.rb', line 82

def byproducts
  @byproducts
end

#metadataObject

Returns the value of attribute metadata.



82
83
84
# File 'app/models/supply_chain/slsa/provenance_statement.rb', line 82

def 
  @metadata
end

Class Method Details

.from_build(build) ⇒ Object



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'app/models/supply_chain/slsa/provenance_statement.rb', line 84

def self.from_build(build)
  builder = {
    id: Gitlab::Routing.url_helpers.project_runner_url(build.project, build.runner),
    version: {
      "gitlab-runner": build.runner_manager.revision
    }
  }

   = {
    invocationId: build.id.to_s,
    # https://github.com/in-toto/attestation/blob/7aefca35a0f74a6e0cb397a8c4a76558f54de571/spec/v1/field_types.md#timestamp
    startedOn: build.started_at&.utc&.rfc3339,
    finishedOn: build.finished_at&.utc&.rfc3339
  }

  RunDetails.new(builder: builder, metadata: )
end