• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang buildfile.Buildfile类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/drone/drone/shared/build/buildfile.Buildfile的典型用法代码示例。如果您正苦于以下问题:Golang Buildfile类的具体用法?Golang Buildfile怎么用?Golang Buildfile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Buildfile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: Write

func (g *Bash) Write(f *buildfile.Buildfile) {
	g.Script = append(g.Script, g.Command)

	for _, cmd := range g.Script {
		f.WriteCmd(cmd)
	}
}
开发者ID:carnivalmobile,项目名称:drone,代码行数:7,代码来源:bash.go


示例2: Write

func (r *ReportCard) Write(f *buildfile.Buildfile) {
	f.WriteCmdSilent(`echo -e "Running report-card"`)

	// Since these include secrets, they *must not* appear in the build output
	f.WriteCmdSilent(`export REPORT_CARD_GITHUB_STATUS_TOKEN=` + os.Getenv("REPORT_CARD_GITHUB_STATUS_TOKEN"))
	f.WriteCmdSilent(`export REPORT_CARD_GITHUB_REPO_TOKEN=` + os.Getenv("REPORT_CARD_GITHUB_REPO_TOKEN"))
	f.WriteCmdSilent(`export REPORT_CARD_API_URL=` + os.Getenv("REPORT_CARD_API_URL"))

	f.WriteCmdSilent(reportcardCmd)
}
开发者ID:Clever,项目名称:drone,代码行数:10,代码来源:report_card.go


示例3: Write

func (m *Marathon) Write(f *buildfile.Buildfile) {
	// debugging purposes so we can see if / where something is failing
	f.WriteCmdSilent("echo 'deploying to Marathon ...'")

	put := fmt.Sprintf(
		"curl -X PUT -d @%s http://%s/v2/apps/%s --header \"Content-Type:application/json\"",
		m.ConfigFile,
		m.Host,
		m.App,
	)
	f.WriteCmdSilent(put)
}
开发者ID:rics3n,项目名称:drone,代码行数:12,代码来源:marathon.go


示例4: Write

func (p *PyPI) Write(f *buildfile.Buildfile) {
	var indexServer string
	var repository string

	if len(p.Username) == 0 || len(p.Password) == 0 {
		// nothing to do if the config is fundamentally flawed
		return
	}

	// Handle the setting a custom pypi server/repository
	if len(p.Repository) == 0 {
		indexServer = "pypi"
		repository = ""
	} else {
		indexServer = "custom"
		repository = fmt.Sprintf("repository:%s", p.Repository)
	}

	f.WriteCmdSilent("echo 'publishing to PyPI...'")

	// find the setup.py file
	f.WriteCmdSilent("_PYPI_SETUP_PY=$(find . -name 'setup.py')")

	// build the .pypirc file that pypi expects
	f.WriteCmdSilent(fmt.Sprintf(pypirc, indexServer, indexServer, p.Username, p.Password, repository))
	formatStr := p.BuildFormatStr()

	// if we found the setup.py file use it to deploy
	f.WriteCmdSilent(fmt.Sprintf(deployCmd, formatStr, indexServer))
}
开发者ID:carnivalmobile,项目名称:drone,代码行数:30,代码来源:pypi.go


示例5: Write

func (cf *CloudFoundry) Write(f *buildfile.Buildfile) {
	downloadCmd := "curl -sLO http://go-cli.s3-website-us-east-1.amazonaws.com/releases/latest/cf-cli_amd64.deb"
	installCmd := "dpkg -i cf-cli_amd64.deb 1> /dev/null 2> /dev/null"

	// download and install the cf tool
	f.WriteCmdSilent(fmt.Sprintf("[ -f /usr/bin/sudo ] && sudo %s || %s", downloadCmd, downloadCmd))
	f.WriteCmdSilent(fmt.Sprintf("[ -f /usr/bin/sudo ] && sudo %s || %s", installCmd, installCmd))

	// login
	loginCmd := "cf login -a %s -u %s -p %s"

	organization := cf.Org
	if organization != "" {
		loginCmd += fmt.Sprintf(" -o %s", organization)
	}

	space := cf.Space
	if space != "" {
		loginCmd += fmt.Sprintf(" -s %s", space)
	}

	f.WriteCmdSilent(fmt.Sprintf(loginCmd, cf.Target, cf.Username, cf.Password))

	// push app
	pushCmd := "cf push %s"
	f.WriteCmd(fmt.Sprintf(pushCmd, cf.App))
}
开发者ID:carnivalmobile,项目名称:drone,代码行数:27,代码来源:cloudfoundry.go


示例6: Write

func (n *Nodejitsu) Write(f *buildfile.Buildfile) {
	if len(n.Token) == 0 || len(n.User) == 0 {
		return
	}

	f.WriteEnv("username", n.User)
	f.WriteEnv("apiToken", n.Token)

	// Install the jitsu command line interface then
	// deploy the configured app.
	f.WriteCmdSilent("[ -f /usr/bin/sudo ] || npm install -g jitsu")
	f.WriteCmdSilent("[ -f /usr/bin/sudo ] && sudo npm install -g jitsu")
	f.WriteCmd("jitsu deploy")
}
开发者ID:carnivalmobile,项目名称:drone,代码行数:14,代码来源:nodejitsu.go


示例7: Write

func (d *Dropbox) Write(f *buildfile.Buildfile) {

	if len(d.AccessToken) == 0 || len(d.Source) == 0 || len(d.Target) == 0 {
		return
	}
	if strings.HasPrefix(d.Target, "/") {
		d.Target = d.Target[1:]
	}

	f.WriteCmdSilent("echo 'publishing to Dropbox ...'")

	cmd := "curl --upload-file %s -H \"Authorization: Bearer %s\" \"https://api-content.dropbox.com/1/files_put/auto/%s?overwrite=true\""
	f.WriteCmd(fmt.Sprintf(cmd, d.Source, d.AccessToken, d.Target))

}
开发者ID:carnivalmobile,项目名称:drone,代码行数:15,代码来源:dropbox.go


示例8: WriteBuild

// WriteBuild adds only the build steps to the build script,
// omitting publish and deploy steps. This is important for
// pull requests, where deployment would be undesirable.
func (b *Build) WriteBuild(f *buildfile.Buildfile) {
	// append environment variables
	for _, env := range b.Env {
		parts := strings.Split(env, "=")
		if len(parts) != 2 {
			continue
		}
		f.WriteEnv(parts[0], parts[1])
	}

	// append build commands
	for _, cmd := range b.Script {
		f.WriteCmd(cmd)
	}
}
开发者ID:grupawp,项目名称:drone,代码行数:18,代码来源:script.go


示例9: Write

// Write adds all the steps to the build script, including
// build commands, deploy and publish commands.
func (b *Build) Write(f *buildfile.Buildfile, r *repo.Repo) {
	// append build commands
	b.WriteBuild(f)

	// write publish commands
	if b.Publish != nil {
		b.Publish.Write(f, r)
	}

	// write deployment commands
	if b.Deploy != nil {
		b.Deploy.Write(f, r)
	}

	// write exit value
	f.WriteCmd("exit 0")
}
开发者ID:grupawp,项目名称:drone,代码行数:19,代码来源:script.go


示例10: Write

func (n *NPM) Write(f *buildfile.Buildfile) {
	// If the yaml doesn't provide a token we should attempt to use the global defaults.
	if len(n.Token) == 0 {
		n.Token = *DefaultToken
	}

	if len(n.Registry) == 0 {
		n.Registry = *DefaultRegistry
	}

	// Setup the npm credentials
	f.WriteCmdSilent(fmt.Sprintf(CmdLogin, n.Registry, n.Token))

	if len(n.Folder) == 0 {
		n.Folder = "."
	}

	f.WriteString(fmt.Sprintf(CmdPublish, n.Folder, n.Tag, n.Folder))
}
开发者ID:Clever,项目名称:drone,代码行数:19,代码来源:npm.go


示例11: Test_Modulus

func Test_Modulus(t *testing.T) {

	g := goblin.Goblin(t)
	g.Describe("Modulus Deploy", func() {

		g.It("Requires a Project name", func() {
			b := new(buildfile.Buildfile)
			m := Modulus{
				Project: "foo",
			}

			m.Write(b)
			g.Assert(b.String()).Equal("")
		})

		g.It("Requires a Token", func() {
			b := new(buildfile.Buildfile)
			m := Modulus{
				Token: "bar",
			}

			m.Write(b)
			g.Assert(b.String()).Equal("")
		})

		g.It("Should execute deploy commands", func() {
			b := new(buildfile.Buildfile)
			m := Modulus{
				Project: "foo",
				Token:   "bar",
			}

			m.Write(b)
			g.Assert(b.String()).Equal(`export MODULUS_TOKEN="bar"
[ -f /usr/bin/npm ] || echo ERROR: npm is required for modulus.io deployments
[ -f /usr/bin/npm ] || exit 1
[ -f /usr/bin/sudo ] || npm install -g modulus
[ -f /usr/bin/sudo ] && sudo npm install -g modulus
echo '#DRONE:6d6f64756c7573206465706c6f79202d702022666f6f22'
modulus deploy -p "foo"
`)
		})
	})
}
开发者ID:carnivalmobile,项目名称:drone,代码行数:44,代码来源:modulus_test.go


示例12: Test_Modulus

func Test_Modulus(t *testing.T) {

	g := goblin.Goblin(t)
	g.Describe("Nodejitsu Deploy", func() {

		g.It("Requires a User", func() {
			b := new(buildfile.Buildfile)
			n := Nodejitsu{
				User: "foo",
			}

			n.Write(b)
			g.Assert(b.String()).Equal("")
		})

		g.It("Requires a Token", func() {
			b := new(buildfile.Buildfile)
			n := Nodejitsu{
				Token: "bar",
			}

			n.Write(b)
			g.Assert(b.String()).Equal("")
		})

		g.It("Should execute deploy commands", func() {
			b := new(buildfile.Buildfile)
			n := Nodejitsu{
				User:  "foo",
				Token: "bar",
			}

			n.Write(b)
			g.Assert(b.String()).Equal(`export username="foo"
export apiToken="bar"
[ -f /usr/bin/sudo ] || npm install -g jitsu
[ -f /usr/bin/sudo ] && sudo npm install -g jitsu
echo '#DRONE:6a69747375206465706c6f79'
jitsu deploy
`)
		})
	})
}
开发者ID:carnivalmobile,项目名称:drone,代码行数:43,代码来源:nodejitsu_test.go


示例13: Write

func (n *NPM) Write(f *buildfile.Buildfile) {
	// If the yaml doesn't provide a username or password
	// we should attempt to use the global defaults.
	if len(n.Email) == 0 ||
		len(n.Username) == 0 ||
		len(n.Password) == 0 {
		n.Username = *DefaultUser
		n.Password = *DefaultPass
		n.Email = *DefaultEmail
	}

	// If the yaml doesn't provide a username or password,
	// and there was not global configuration defined, EXIT.
	if len(n.Email) == 0 ||
		len(n.Username) == 0 ||
		len(n.Password) == 0 {
		return
	}

	// Setup the npm credentials
	f.WriteCmdSilent(fmt.Sprintf(CmdLogin, n.Username, n.Password, n.Email))

	// Setup custom npm registry
	if len(n.Registry) != 0 {
		f.WriteCmd(fmt.Sprintf(CmdSetRegistry, n.Registry))
	}

	// Set npm to always authenticate
	if n.AlwaysAuth {
		f.WriteCmd(CmdAlwaysAuth)
	}

	var cmd = fmt.Sprintf(CmdPublish, n.Folder)
	if len(n.Tag) != 0 {
		cmd += fmt.Sprintf(" --tag %s", n.Tag)
	}

	if n.Force {
		cmd += " --force"
	}

	f.WriteCmd(cmd)
}
开发者ID:carnivalmobile,项目名称:drone,代码行数:43,代码来源:npm.go


示例14: Write

// Write down the buildfile
func (s *SSH) Write(f *buildfile.Buildfile) {
	host := strings.SplitN(s.Target, " ", 2)
	if len(host) == 1 {
		host = append(host, "22")
	}
	if _, err := strconv.Atoi(host[1]); err != nil {
		host[1] = "22"
	}

	// Is artifact created?
	artifact := false

	for _, a := range s.Artifacts {
		if a == "GITARCHIVE" {
			artifact = createGitArchive(f)
			break
		}
	}

	if !artifact {
		if len(s.Artifacts) > 1 {
			artifact = compress(f, s.Artifacts)
		} else if len(s.Artifacts) == 1 {
			f.WriteEnv("ARTIFACT", s.Artifacts[0])
			artifact = true
		}
	}

	if artifact {
		scpCmd := "scp -o StrictHostKeyChecking=no -P %s -r ${ARTIFACT} %s"
		f.WriteCmd(fmt.Sprintf(scpCmd, host[1], host[0]))
	}

	if len(s.Cmd) > 0 {
		sshCmd := "ssh -o StrictHostKeyChecking=no -p %s %s \"%s\""
		f.WriteCmd(fmt.Sprintf(sshCmd, host[1], strings.SplitN(host[0], ":", 2)[0], s.Cmd))
	}
}
开发者ID:grupawp,项目名称:drone,代码行数:39,代码来源:ssh.go


示例15: Write

func (h *Heroku) Write(f *buildfile.Buildfile) {
	f.WriteCmdSilent(CmdRevParse)
	f.WriteCmdSilent(CmdGlobalUser)
	f.WriteCmdSilent(CmdGlobalEmail)
	f.WriteCmdSilent(fmt.Sprintf(CmdLogin, h.Token))

	// add heroku as a git remote
	f.WriteCmd(fmt.Sprintf("git remote add heroku https://git.heroku.com/%s.git", h.App))

	switch h.Force {
	case true:
		// this is useful when the there are artifacts generated
		// by the build script, such as less files converted to css,
		// that need to be deployed to Heroku.
		f.WriteCmd(fmt.Sprintf("git add -A"))
		f.WriteCmd(fmt.Sprintf("git commit -m 'adding build artifacts'"))
		f.WriteCmd(fmt.Sprintf("git push heroku HEAD:refs/heads/master --force"))
	case false:
		// otherwise we just do a standard git push
		f.WriteCmd(fmt.Sprintf("git push heroku $COMMIT:refs/heads/master"))
	}
}
开发者ID:carnivalmobile,项目名称:drone,代码行数:22,代码来源:heroku.go


示例16: Write

// Write adds commands to run that will publish a Github release.
func (g *Github) Write(f *buildfile.Buildfile) {
	if len(g.Artifacts) == 0 || g.Tag == "" || g.Token == "" || g.User == "" || g.Repo == "" {
		f.WriteCmdSilent(`echo -e "Github Plugin: Missing argument(s)"\n\n`)
		if len(g.Artifacts) == 0 {
			f.WriteCmdSilent(`echo -e "\tartifacts not defined in yaml config" && false`)
		}
		if g.Tag == "" {
			f.WriteCmdSilent(`echo -e "\ttag not defined in yaml config" && false`)
		}
		if g.Token == "" {
			f.WriteCmdSilent(`echo -e "\ttoken not defined in yaml config" && false`)
		}
		if g.User == "" {
			f.WriteCmdSilent(`echo -e "\tuser not defined in yaml config" && false`)
		}
		if g.Repo == "" {
			f.WriteCmdSilent(`echo -e "\trepo not defined in yaml config" && false`)
		}
		return
	}

	// Default name is tag
	if g.Name == "" {
		g.Name = g.Tag
	}

	for _, cmd := range g.Script {
		f.WriteCmd(cmd)
	}

	f.WriteEnv("GITHUB_TOKEN", g.Token)

	// Install github-release
	f.WriteCmd("curl -L -o /tmp/github-release.tar.bz2 https://github.com/aktau/github-release/releases/download/v0.5.2/linux-amd64-github-release.tar.bz2")
	f.WriteCmd("tar jxf /tmp/github-release.tar.bz2 -C /tmp/ && sudo mv /tmp/bin/linux/amd64/github-release /usr/local/bin/github-release")

	// Create the release. Ignore 422 errors, which indicate the tag has already been created.
	// Doing otherwise would create the expectation that every commit should be tagged and released,
	// which is not the norm.
	draftStr := ""
	if g.Draft {
		draftStr = "--draft"
	}
	prereleaseStr := ""
	if g.Prerelease {
		prereleaseStr = "--pre-release"
	}
	f.WriteCmd(fmt.Sprintf(`
result=$(github-release release -u %s -r %s -t %s -n "%s" -d "%s" %s %s || true)
if [[ $result == *422* ]]; then
  echo -e "Release already exists for this tag.";
  exit 0
elif [[ $result == "" ]]; then
  echo -e "Release created.";
else
  echo -e "Error creating release: $result"
  exit 1
fi
`, g.User, g.Repo, g.Tag, g.Name, g.Description, draftStr, prereleaseStr))

	// Upload files
	artifactStr := strings.Join(g.Artifacts, " ")
	f.WriteCmd(fmt.Sprintf(`
for f in %s; do
    # treat directories and files differently
    if [ -d $f ]; then
        for ff in $(ls $f); do
            echo -e "uploading $ff"
            github-release upload -u %s -r %s -t %s -n $ff -f $f/$ff
        done
    elif [ -f $f ]; then
        echo -e "uploading $f"
        github-release upload -u %s -r %s -t %s -n $f -f $f
    else
        echo -e "$f is not a file or directory"
        exit 1
    fi
done
`, artifactStr, g.User, g.Repo, g.Tag, g.User, g.Repo, g.Tag))
}
开发者ID:carnivalmobile,项目名称:drone,代码行数:81,代码来源:github.go


示例17: Test_NPM

func Test_NPM(t *testing.T) {

	g := goblin.Goblin(t)
	g.Describe("NPM Publish", func() {

		g.BeforeEach(func() {
			var user, pass, email = "", "", ""
			DefaultEmail = &user
			DefaultUser = &pass
			DefaultPass = &email
		})

		g.It("Should run publish", func() {
			b := new(buildfile.Buildfile)
			n := NPM{
				Email:    "[email protected]",
				Username: "foo",
				Password: "bar",
				Folder:   "/path/to/repo",
			}

			n.Write(b)
			out := b.String()
			g.Assert(strings.Contains(out, "npm publish /path/to/repo\n")).Equal(true)
			g.Assert(strings.Contains(out, "\nnpm set")).Equal(false)
			g.Assert(strings.Contains(out, "\nnpm config set")).Equal(false)
		})

		g.It("Should use current directory if folder is empty", func() {
			b := new(buildfile.Buildfile)
			n := NPM{
				Email:    "[email protected]",
				Username: "foo",
				Password: "bar",
			}

			n.Write(b)
			g.Assert(strings.Contains(b.String(), "npm publish .\n")).Equal(true)
		})

		g.It("Should set tag", func() {
			b := new(buildfile.Buildfile)
			n := NPM{
				Email:    "[email protected]",
				Username: "foo",
				Password: "bar",
				Folder:   "/path/to/repo",
				Tag:      "1.0.0",
			}

			n.Write(b)
			g.Assert(strings.Contains(b.String(), "\n_NPM_PACKAGE_TAG=\"1.0.0\"\n")).Equal(true)
			g.Assert(strings.Contains(b.String(), "npm tag ${_NPM_PACKAGE_NAME} ${_NPM_PACKAGE_TAG}\n")).Equal(true)
		})

		g.It("Should set registry", func() {
			b := new(buildfile.Buildfile)
			n := NPM{
				Email:    "[email protected]",
				Username: "foo",
				Password: "bar",
				Folder:   "/path/to/repo",
				Registry: "https://npmjs.com",
			}

			n.Write(b)
			g.Assert(strings.Contains(b.String(), "\nnpm config set registry https://npmjs.com\n")).Equal(true)
		})

		g.It("Should set always-auth", func() {
			b := new(buildfile.Buildfile)
			n := NPM{
				Email:      "[email protected]",
				Username:   "foo",
				Password:   "bar",
				Folder:     "/path/to/repo",
				AlwaysAuth: true,
			}

			n.Write(b)
			g.Assert(strings.Contains(b.String(), CmdAlwaysAuth)).Equal(true)
		})

		g.It("Should skip when no username or password", func() {
			b := new(buildfile.Buildfile)
			n := new(NPM)

			n.Write(b)
			g.Assert(b.String()).Equal("")
		})

		g.It("Should use default username or password", func() {
			b := new(buildfile.Buildfile)
			n := new(NPM)

			expected := `cat <<EOF > ~/.npmrc
_auth = $(echo "foo:bar" | tr -d "\r\n" | base64)
email = [email protected]
EOF`

//.........这里部分代码省略.........
开发者ID:zankard,项目名称:drone,代码行数:101,代码来源:npm_test.go


示例18: Write

func (b *Bintray) Write(f *buildfile.Buildfile) {
	var cmd string

	// Validate Username, ApiKey, Packages
	if len(b.Username) == 0 || len(b.ApiKey) == 0 || len(b.Packages) == 0 {
		f.WriteCmdSilent(`echo -e "Bintray Plugin: Missing argument(s)\n\n"`)

		if len(b.Username) == 0 {
			f.WriteCmdSilent(`echo -e "\tusername not defined in yaml config"`)
		}

		if len(b.ApiKey) == 0 {
			f.WriteCmdSilent(`echo -e "\tapi_key not defined in yaml config"`)
		}

		if len(b.Packages) == 0 {
			f.WriteCmdSilent(`echo -e "\tpackages not defined in yaml config"`)
		}

		f.WriteCmdSilent("exit 1")

		return
	}

	for _, pkg := range b.Packages {
		pkg.Write(b.Username, b.ApiKey, f)
	}

	f.WriteCmd(cmd)

}
开发者ID:zankard,项目名称:drone,代码行数:31,代码来源:bintray.go


示例19: writeApplicationUpdate

func (c *Catapult) writeApplicationUpdate(f *buildfile.Buildfile, appName string) {
	repo := c.Repo.Name[len("github.com/Clever/"):]
	branch := c.Repo.Branch
	if branch == "" {
		branch = "master"
	}

	application := CatapultApplication{
		ID:        appName,
		Source:    fmt.Sprintf("github:clever/%[email protected]%s", repo, c.Repo.Commit),
		Artifacts: fmt.Sprintf("dockerhub:clever/%s", repo),
		Branch:    branch,
	}
	applicationJSON, err := json.Marshal(application)
	if err != nil {
		f.WriteCmdSilent(`echo -e "Failed to marshal application"`)
		return
	}

	catapultURL, err := url.Parse(c.CatapultURL)
	if err != nil {
		f.WriteCmdSilent(`echo -e "not able to parse catapult url"; exit 1;`)
		return
	}

	if catapultURL.Host == "" {
		f.WriteCmdSilent(`echo -e "malformed catapult url (make sure to include the proto portion)"; exit 1;`)
		return
	}

	// Make a copy of the url
	postURL := *catapultURL
	postURL.Path = "/applications/"

	putURL := *catapultURL
	putURL.Path = fmt.Sprintf("/applications/%s", application.ID)

	f.WriteCmdSilent(fmt.Sprintf(catapultAppPublishCmd, string(applicationJSON), &postURL, &putURL))

	build := CatapultBuild{
		ID:          c.Repo.Commit[0:7],
		Application: application.ID,
		Date:        time.Now().Format(time.RFC3339),
		Source:      application.Artifacts,
		GitHash:     c.Repo.Commit,
		Branch:      branch,
	}

	buildJSON, err := json.Marshal(build)
	if err != nil {
		f.WriteCmdSilent(`echo -e "Failed to marshal build"; exit 1;`)
		return
	}

	buildPostURL := *catapultURL
	buildPostURL.Path = fmt.Sprintf("/applications/%s/builds", application.ID)

	buildPutURL := *catapultURL
	buildPutURL.Path = fmt.Sprintf("/applications/%s/builds/%s", application.ID, c.Repo.Commit[0:7])

	f.WriteCmdSilent(fmt.Sprintf(catapultBuildPublishCmd,
		string(buildJSON), &buildPostURL, &buildPutURL))
}
开发者ID:Clever,项目名称:drone,代码行数:63,代码来源:catapult.go


示例20: Write

// Write adds commands to the buildfile to do the following:
// 1. Update application definition in catapult
// 2. [TODO] add build to Catapult
func (c *Catapult) Write(f *buildfile.Buildfile) {
	f.WriteCmdSilent(`echo -e "Starting the catapult publish plugin..."`)
	if len(c.CatapultURL) == 0 || (len(c.ApplicationName) == 0 && len(c.ApplicationNames) == 0) {
		f.WriteCmdSilent(`echo -e "Catapult Plugin: Missing argument(s)\n\n"`)
		if len(c.CatapultURL) == 0 {
			f.WriteCmdSilent(`echo -e "\turl not defined in yaml"`)
		}
		if len(c.ApplicationName) == 0 || len(c.ApplicationNames) == 0 {
			f.WriteCmdSilent(`echo -e "\tapplication not defined in yaml"`)
		}
		f.WriteCmdSilent(`exit 1`) // Here to fail build
		return
	}

	if len(c.ApplicationName) > 0 && len(c.ApplicationNames) > 0 {
		f.WriteCmdSilent(`echo -e "\tDefine either 'application' or 'applications' in yaml.  Not both."`)
		f.WriteCmdSilent(`exit 1`) // Here to fail build
	} else if len(c.ApplicationName) > 0 {
		c.writeApplicationUpdate(f, c.ApplicationName)
	} else {
		for _, appName := range c.ApplicationNames {
			f.WriteCmdSilent(fmt.Sprintf(`echo -e "Updating application %s in catapult..."`, appName))
			c.writeApplicationUpdate(f, appName)
		}
	}
}
开发者ID:Clever,项目名称:drone,代码行数:29,代码来源:catapult.go



注:本文中的github.com/drone/drone/shared/build/buildfile.Buildfile类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang log.Errf函数代码示例发布时间:2022-05-23
下一篇:
Golang session.User函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap