portainer-devtool/go/repositories/agent/push_image.go

33 lines
796 B
Go

package agent
import (
"ocl/portainer-devtool/configs"
"ocl/portainer-devtool/tasks/common"
"ocl/portainer-devtool/utils"
)
type PushImageSubTask struct {
common.GeneralTask
}
func NewPushImageSubTask(cfg *configs.Config) *PushImageSubTask {
return &PushImageSubTask{
GeneralTask: *common.NewGeneralTask(cfg),
}
}
func (task *PushImageSubTask) Execute() error {
utils.SuccessPrint(`
export CR_PAT=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
echo $CR_PAT | docker login ghcr.io -u oscarzhou-portainer --password-stdin
docker image tag portainerci/agent:develop-78af729 ghcr.io/oscarzhou-portainer/agent:develop-78af729
docker push ghcr.io/oscarzhou-portainer/agent:develop-78af729docker
`)
return nil
}
func (task *PushImageSubTask) String() string {
return "Push Docker Image"
}