github.com/mponton/terratest@v0.44.0/modules/docker/push.go (about)

     1  package docker
     2  
     3  import (
     4  	"github.com/mponton/terratest/modules/logger"
     5  	"github.com/mponton/terratest/modules/shell"
     6  	"github.com/mponton/terratest/modules/testing"
     7  	"github.com/stretchr/testify/require"
     8  )
     9  
    10  // Push runs the 'docker push' command to push the given tag. This will fail the test if there are any errors.
    11  func Push(t testing.TestingT, logger *logger.Logger, tag string) {
    12  	require.NoError(t, PushE(t, logger, tag))
    13  }
    14  
    15  // PushE runs the 'docker push' command to push the given tag.
    16  func PushE(t testing.TestingT, logger *logger.Logger, tag string) error {
    17  	logger.Logf(t, "Running 'docker push' for tag %s", tag)
    18  
    19  	cmd := shell.Command{
    20  		Command: "docker",
    21  		Args:    []string{"push", tag},
    22  		Logger:  logger,
    23  	}
    24  	return shell.RunCommandE(t, cmd)
    25  }