Adding stable release to builder.

This commit is contained in:
Colin Lyons
2022-12-29 01:58:12 +00:00
parent 343a5ddb79
commit e2cc9e932e
2 changed files with 32 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ import (
"github.com/cybriq/proc/pkg/cmds"
"github.com/cybriq/proc/pkg/opts/config"
"github.com/cybriq/proc/pkg/opts/list"
"github.com/cybriq/proc/pkg/opts/meta"
)
var (
@@ -43,7 +44,24 @@ var (
Documentation: lorem,
Entrypoint: serveHandler,
Configs: config.Opts{
list.New():
"seed": list.New(meta.Data{
Label: "seed",
Description: "Adds additional seeds by hostname, or multiaddress. Examples: seed0.example.com, /ip4/127.0.0.1/tcp/8337",
Documentation: lorem,
Default: "/ip4/172.16.238.2/tcp/8337",
}, func(opt *list.Opt) error {
return nil
}),
"listen": list.New(meta.Data{
Label: "listen",
Description: "A list of listener multiaddresses. Example: /ip4/0.0.0.0/tcp/8337",
Documentation: lorem,
Default: "/ip4/0.0.0.0/tcp/8337",
}, func(opt *list.Opt) error {
return nil
}),
},
},
},

View File

@@ -25,11 +25,13 @@ var (
)
var (
buildContextFilePath = "/tmp/indra-build.tar"
buildContextFilePath = "/tmp/indra-" + indra.SemVer + ".tar"
buildRepositoryName = "indralabs/indra"
isRelease = false
buildOpts = types.ImageBuildOptions{
Tags: []string{
"indralabs/indra:" + indra.SemVer,
"indralabs/indra:latest",
buildRepositoryName + ":" + indra.SemVer,
buildRepositoryName +":" + "latest",
},
Dockerfile: "docker/indra/Dockerfile",
SuppressOutput: false,
@@ -58,6 +60,10 @@ func (cli *Builder) Build() (err error) {
defer tar.Close()
if isRelease {
buildOpts.Tags = append(buildOpts.Tags, buildRepositoryName + ":" + "stable")
}
log.I.Ln("submitting build to docker...")
// Submit a build to docker; with the context tar, and default options defined above.
@@ -97,6 +103,7 @@ func (cli *Builder) Push(opts types.ImagePushOptions) (err error) {
return
}
// Load the docker config
config := configfile.New("config.json")
config.LoadFromReader(bytes.NewReader(file))
@@ -105,15 +112,18 @@ func (cli *Builder) Push(opts types.ImagePushOptions) (err error) {
var pushResponse io.ReadCloser
// Run through all repositories.
for _, auth := range config.AuthConfigs {
log.I.Ln("found", auth.ServerAddress)
// Generate an authentication token
authConfigBytes, _ := json.Marshal(auth)
authConfigEncoded := base64.URLEncoding.EncodeToString(authConfigBytes)
opts.RegistryAuth = authConfigEncoded
// Pushes each tag to the docker repository.
for _, tag := range buildOpts.Tags {
log.I.Ln("pushing", tag)