feat: [CI-20527]: add push-only mode to skip build and push pre-existing images (#500)

* Add push-only support

* Include support for PLUGIN_NO_PUSH as well
This commit is contained in:
OP (oppenheimer)
2026-01-26 22:55:18 +05:30
committed by GitHub
parent 6799ac9418
commit aabeaaf7bb
3 changed files with 216 additions and 5 deletions
+12 -2
View File
@@ -17,8 +17,14 @@ import (
"github.com/inhies/go-bytesize"
)
// writeCard maintains backward compatibility by using TempTag
func (p Plugin) writeCard() error {
cmd := exec.Command(dockerExe, "inspect", p.Build.TempTag)
return p.writeCardForImage(p.Build.TempTag)
}
// writeCardForImage generates card for any image reference
func (p Plugin) writeCardForImage(imageRef string) error {
cmd := exec.Command(dockerExe, "inspect", imageRef)
data, err := cmd.CombinedOutput()
if err != nil {
return err
@@ -38,7 +44,11 @@ func (p Plugin) writeCard() error {
for _, tag := range inspect.RepoTags {
sliceTagStruct = append(sliceTagStruct, TagStruct{Tag: tag})
}
inspect.ParsedRepoTags = sliceTagStruct[1:] // remove the first tag which is always "hash:latest"
if len(sliceTagStruct) > 1 {
inspect.ParsedRepoTags = sliceTagStruct[1:] // remove the first tag which is always "hash:latest"
} else {
inspect.ParsedRepoTags = sliceTagStruct
}
// create the url from repo and registry
inspect.URL = mapRegistryToURL(p.Daemon.Registry, p.Build.Repo)
cardData, _ := json.Marshal(inspect)