コード例 #1
0
func (s *RegistrationContext) askRunner() common.RunnerConfig {
	url := s.ask("url", "Please enter the gitlab-ci coordinator URL (e.g. http://gitlab-ci.org:3000/):")
	registrationToken := s.ask("registration-token", "Please enter the gitlab-ci token for this runner:")
	description := s.ask("description", "Please enter the gitlab-ci description for this runner:")
	tagList := s.String("tag-list")

	result := common.RegisterRunner(url, registrationToken, description, tagList)
	if result == nil {
		log.Fatalf("Failed to register this runner. Perhaps you are having network problems")
	}

	return common.RunnerConfig{
		URL:   url,
		Name:  description,
		Token: result.Token,
	}
}
コード例 #2
0
func (s *RegisterCommand) askRunner() {
	s.URL = s.ask("url", "Please enter the gitlab-ci coordinator URL (e.g. https://ci.gitlab.com/):")

	if s.Token != "" {
		if !common.VerifyRunner(s.URL, s.Token) {
			log.Fatalln("Failed to verify this runner. Perhaps you are having network problems")
		}
	} else {
		s.RegistrationToken = s.ask("registration-token", "Please enter the gitlab-ci token for this runner:")
		s.Name = s.ask("name", "Please enter the gitlab-ci description for this runner:")
		s.TagList = s.ask("tag-list", "Please enter the gitlab-ci tags for this runner (comma separated):")

		result := common.RegisterRunner(s.URL, s.RegistrationToken, s.Name, s.TagList)
		if result == nil {
			log.Fatalln("Failed to register this runner. Perhaps you are having network problems")
		}

		s.Token = result.Token
		s.registered = true
	}
}
コード例 #3
0
func (s *RegisterCommand) askRunner() {
	s.URL = s.ask("url", "Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/ci):")

	if s.Token != "" {
		log.Infoln("Token specified trying to verify runner...")
		log.Warningln("If you want to register use the '-r' instead of '-t'.")
		if !common.VerifyRunner(s.URL, s.Token) {
			log.Fatalln("Failed to verify this runner. Perhaps you are having network problems")
		}
	} else {
		s.RegistrationToken = s.ask("registration-token", "Please enter the gitlab-ci token for this runner:")
		s.Name = s.ask("name", "Please enter the gitlab-ci description for this runner:")
		s.TagList = s.ask("tag-list", "Please enter the gitlab-ci tags for this runner (comma separated):", true)

		result := common.RegisterRunner(s.URL, s.RegistrationToken, s.Name, s.TagList)
		if result == nil {
			log.Fatalln("Failed to register this runner. Perhaps you are having network problems")
		}

		s.Token = result.Token
		s.registered = true
	}
}