architect

package
v2.7.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2022 License: LGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Bc = &cobra.Command{
	Use:   "bc",
	Short: "build bc --file <bc>.json",
	Long:  "Build images from openshift build configurations",
	Run: func(cmd *cobra.Command, args []string) {

		var nexusDownloader nexus.Downloader
		if verbose {
			logrus.SetLevel(logrus.DebugLevel)
		} else {
			logrus.SetLevel(logrus.InfoLevel)
		}

		configPath := cmd.Flag("file").Value.String()
		logrus.Debugf("Building from %s", configPath)

		// Read build config
		var configReader = config.NewFileConfigReader(configPath)

		c, err := configReader.ReadConfig()
		if err != nil {
			logrus.Fatalf("Could not read configuration: %s", err)
		}
		nexusAccess, err := config.ReadNexusAccessFromEnvVars()
		if err != nil {
			logrus.Fatalf("Unable to get Nexus credentials: %s", err)
		}

		nexusDownloader = nexus.NewMavenDownloader(nexusAccess.NexusURL, nexusAccess.Username, nexusAccess.Password)

		RunArchitect(RunConfiguration{
			NexusDownloader:         nexusDownloader,
			Config:                  c,
			RegistryCredentialsFunc: docker.LocalRegistryCredentials(),
		})
	},
}

Bc build command using buildConfig as input

View Source
var Build = &cobra.Command{
	Use:   "build",
	Short: "build file --file <file> --from <baseimage:version> --output <repository:tag> --type [java | nodejs | doozer]",
	Long:  "build images from source",
	Run: func(cmd *cobra.Command, args []string) {

		var nexusDownloader nexus.Downloader
		if verbose {
			logrus.SetLevel(logrus.DebugLevel)
		} else {
			logrus.SetLevel(logrus.InfoLevel)
		}

		notValid := len(cmd.Flag("file").Value.String()) == 0 ||
			len(cmd.Flag("output").Value.String()) == 0 ||
			len(cmd.Flag("from").Value.String()) == 0 ||
			len(cmd.Flag("type").Value.String()) == 0

		if notValid {
			err := cmd.Help()
			if err != nil {
				panic(err)
			}
			return
		}

		leveransepakke := cmd.Flag("file").Value.String()
		logrus.Debugf("Building %s", leveransepakke)

		// Read build config
		var configReader = config.NewCmdConfigReader(cmd, args, noPush)
		c, err := configReader.ReadConfig()

		if err != nil {
			logrus.Fatalf("Could not read configuration: %s", err)
		}

		var binaryInput string

		binaryInput, err = util.ExtractBinaryFromFile(leveransepakke)
		if err != nil {
			logrus.Fatalf("Could not read binary input: %s", err)
		}

		nexusDownloader = nexus.NewBinaryDownloader(binaryInput)

		RunArchitect(RunConfiguration{
			NexusDownloader:         nexusDownloader,
			Config:                  c,
			RegistryCredentialsFunc: docker.LocalRegistryCredentials(),
		})
	},
}

Build command

Functions

func RunArchitect

func RunArchitect(configuration RunConfiguration)

RunArchitect main

Types

type RunConfiguration

type RunConfiguration struct {
	NexusDownloader         nexus.Downloader
	Config                  *config.Config
	RegistryCredentialsFunc func(string) (*docker.RegistryCredentials, error)
	PushUsername            string
	PushToken               string
}

RunConfiguration runtime configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL