mirror of
https://github.com/drone-plugins/drone-docker.git
synced 2026-06-04 10:15:30 +08:00
Use unique build name for build and tag
This commit is contained in:
@@ -17,8 +17,8 @@ import (
|
||||
"github.com/inhies/go-bytesize"
|
||||
)
|
||||
|
||||
func (p Plugin) writeCard() error {
|
||||
cmd := exec.Command(dockerExe, "inspect", p.Build.Name)
|
||||
func (p Plugin) writeCard(buildName string) error {
|
||||
cmd := exec.Command(dockerExe, "inspect", buildName)
|
||||
data, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -225,12 +225,12 @@ func (p Plugin) Exec() error {
|
||||
}
|
||||
|
||||
// output the adaptive card
|
||||
if err := p.writeCard(); err != nil {
|
||||
if err := p.writeCard(buildName); err != nil {
|
||||
fmt.Printf("Could not create adaptive card. %s\n", err)
|
||||
}
|
||||
|
||||
if p.ArtifactFile != "" {
|
||||
if digest, err := getDigest(p.Build.Name); err == nil {
|
||||
if digest, err := getDigest(buildName); err == nil {
|
||||
if err = drone.WritePluginArtifactFile(p.Daemon.RegistryType, p.ArtifactFile, p.Daemon.Registry, p.Build.Repo, digest, p.Build.Tags); err != nil {
|
||||
fmt.Printf("failed to write plugin artifact file at path: %s with error: %s\n", p.ArtifactFile, err)
|
||||
}
|
||||
@@ -244,8 +244,8 @@ func (p Plugin) Exec() error {
|
||||
// clear the slice
|
||||
cmds = nil
|
||||
|
||||
cmds = append(cmds, commandRmi(p.Build.Name)) // docker rmi
|
||||
cmds = append(cmds, commandPrune()) // docker system prune -f
|
||||
cmds = append(cmds, commandRmi(buildName)) // docker rmi
|
||||
cmds = append(cmds, commandPrune()) // docker system prune -f
|
||||
|
||||
for _, cmd := range cmds {
|
||||
cmd.Stdout = os.Stdout
|
||||
|
||||
Reference in New Issue
Block a user