コード例 #1
0
ファイル: aci-push.go プロジェクト: HimanshPal/cnt
func (aci *Aci) Push() {
	if cnt.Home.Config.Push.Type == "" {
		panic("Can't push, push is not configured in cnt global configuration file")
	}

	aci.CheckBuilt()
	if aci.args.Test {
		aci.args.Test = false
		aci.Test()
	}

	aci.tarAci(true)

	im := utils.ExtractManifestFromAci(aci.target + PATH_IMAGE_ACI_ZIP)
	val, _ := im.Labels.Get("version")
	if err := utils.ExecCmd("curl", "-f", "-i",
		"-F", "r=releases",
		"-F", "hasPom=false",
		"-F", "e=aci",
		"-F", "g=com.blablacar.aci.linux.amd64",
		"-F", "p=aci",
		"-F", "v="+val,
		"-F", "a="+strings.Split(string(im.Name), "/")[1],
		"-F", "file=@"+aci.target+PATH_IMAGE_ACI_ZIP,
		"-u", cnt.Home.Config.Push.Username+":"+cnt.Home.Config.Push.Password,
		cnt.Home.Config.Push.Url+"/service/local/artifact/maven/content"); err != nil {
		panic("Cannot push aci" + err.Error())
	}
}
コード例 #2
0
ファイル: command.go プロジェクト: HimanshPal/cnt
//	Long:  `update an aci`,
//	Run: func(cmd *cobra.Command, args []string) {
//		runCleanIfRequested(workPath, buildArgs)
//		buildAciOrPod(workPath, buildArgs).Update()
//	},
//}

var aciVersion = &cobra.Command{
	Use:   "aci-version file",
	Short: "display version of aci",
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) != 1 {
			cmd.Usage()
			os.Exit(1)
		}
		im := utils.ExtractManifestFromAci(args[0])
		val, _ := im.Labels.Get("version")
		println(val)
	},
}

var versionCmd = &cobra.Command{
	Use:   "version",
	Short: "Version of cnt",
	Long:  `Print the version number of cnt`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Print("Cnt\n\n")
		fmt.Printf("version    : %s\n", cnt.Version)
		if cnt.BuildDate != "" {
			fmt.Printf("build date : %s\n", cnt.BuildDate)
		}