mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-21 07:21:40 -04:00
* Add working registry pkg * Add custom error for handling the loading of PAR environment variables * Working Publish to Build, with proper error handling for bucket names * Update hcp-sdk-go to use branch instead of mod replace directive * Update Packer build status configuration * Add support for HCP_PACKER_BUILD_FINGERPRINT env * Add support for publishing one or more PARtifacts from a single build * add git shas to this branch * Add ability to set provider name if available * Add working RegistryBuilder type * Add RegistryPostProcessor as wrapper post-processor * When in PAR mode a empty RegistryPostProcessor is added to the end of the post-processor list to publish all final image data. * Add support for updating a build from PAR that is not in a DONE state * Fix a small issue with creation the initial builds for an empty iteration. * Add PAR URL to post-processor display * Implement hcp_packer_registry block (#11168) * Update vendored Amazon plugin to v1.0.1-dev * Fix panic when running a Packer registry build in a clean directory * Remove the publishing of post-processor metadata from the registry post-processor. * Remove metadata add from registry_builder * Update registry builder to skip a build that was found to be DONE Co-authored-by: Megan Marsh <[email protected]> Co-authored-by: Sylvia Moss <[email protected]>
45 lines
733 B
Go
45 lines
733 B
Go
package file
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
type FileArtifact struct {
|
|
filename string
|
|
}
|
|
|
|
func (*FileArtifact) BuilderId() string {
|
|
return BuilderId
|
|
}
|
|
|
|
func (a *FileArtifact) Files() []string {
|
|
return []string{a.filename}
|
|
}
|
|
|
|
func (a *FileArtifact) Id() string {
|
|
return "File"
|
|
}
|
|
|
|
func (a *FileArtifact) String() string {
|
|
return fmt.Sprintf("Stored file: %s", a.filename)
|
|
}
|
|
|
|
func (a *FileArtifact) State(name string) interface{} {
|
|
if name == "par.artifact.metadata" {
|
|
metadata := make(map[string]string)
|
|
metadata["ImageID"] = a.filename
|
|
metadata["ProviderName"] = a.Id()
|
|
|
|
return metadata
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (a *FileArtifact) Destroy() error {
|
|
log.Printf("Deleting %s", a.filename)
|
|
return os.Remove(a.filename)
|
|
}
|