|
|
|
|
@ -6,6 +6,7 @@ import (
|
|
|
|
|
"os"
|
|
|
|
|
"os/signal"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
"regexp"
|
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
"github.com/hashicorp/atlas-go/archive"
|
|
|
|
|
@ -16,6 +17,11 @@ import (
|
|
|
|
|
// archiveTemplateEntry is the name the template always takes within the slug.
|
|
|
|
|
const archiveTemplateEntry = ".packer-template"
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
reName = regexp.MustCompile("^[a-zA-Z0-9-_/]+$")
|
|
|
|
|
errInvalidName = fmt.Errorf("Your build name can only contain these characters: [a-zA-Z0-9-_]+")
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type PushCommand struct {
|
|
|
|
|
Meta
|
|
|
|
|
|
|
|
|
|
@ -88,6 +94,11 @@ func (c *PushCommand) Run(args []string) int {
|
|
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if !reName.MatchString(name) {
|
|
|
|
|
c.Ui.Error(errInvalidName.Error())
|
|
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Determine our token
|
|
|
|
|
if token == "" {
|
|
|
|
|
token = push.Token
|
|
|
|
|
|