Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): add APIs for getting pipeline templates and detecting repo type #557

Merged
merged 5 commits into from
Sep 3, 2018

Conversation

zhujian7
Copy link
Collaborator

What this PR does / why we need it:

Add your description

Which issue(s) this PR is related to (optional, link to 3rd issue(s)):

Fixes #

Reference to #

Special notes for your reviewer:

/cc @

Release note:

NONE

@caicloud-bot caicloud-bot added release-note-none Denotes a PR that doesn't merit a release note. caicloud-cla: yes Indicates the PR's author has not signed the Caicloud CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 28, 2018
@zhujian7
Copy link
Collaborator Author

/hold

@caicloud-bot caicloud-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 28, 2018
@caicloud-bot caicloud-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 30, 2018
@zhujian7 zhujian7 changed the title docs(api): add pipeline templates and repository type api feat(api): add APIs for getting pipeline templates and detecting repo type Aug 30, 2018
@zhujian7
Copy link
Collaborator Author

/hold cancel

@caicloud-bot caicloud-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 30, 2018
@zhujian7
Copy link
Collaborator Author

/cc @supereagle

config/templates/templates.yaml Show resolved Hide resolved
npm run build
customizedDockerfile: |


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use --- instead of blank line to separate.


| API | Path | Detail |
| --- | --- | --- |
| List | GET `/api/v1/templates` | WIP, [link](#list-templates) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use pipelinetemplates, as maybe need to support other templates.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have fixed


| Field | Note |
| --- | --- |
| repo | Required, repo for which the tags will be listed |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the note

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have fixed

language := getTopLanguage(languages)

switch language {
case api.JavaRepoType:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some duplicated code. What about?

	switch language {
	case api.JavaRepoType,api.JavaScriptRepoType:
		files, err := getContents(g.scmCfg, v3APIVersion, repo)
		if err != nil {
			log.Error("get contents failed:%v", err)
			return language, nil
		}
 		for _, f := range files {
			if strings.Contains(f.Name, "pom.xml") {
				return api.MavenRepoType, nil
			}
			if strings.Contains(f.Name, "build.gradle") {
				return api.GradleRepoType, nil
			}
			if strings.Contains(f.Name, "package.json") {
				return api.NodeRepoType, nil
			}
		}
	}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

customizedDockerfile: |
FROM jboss/base-jdk:8

MAINTAINER cyclone "cyclone@caicloud.io"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有这个邮箱吗。。。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol, i don't know, have deleted it.

@supereagle
Copy link
Member

/lgtm

@caicloud-bot caicloud-bot added the lgtm Indicates that a PR is ready to be merged. label Sep 3, 2018
@caicloud-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: supereagle

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@caicloud-bot caicloud-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 3, 2018
@caicloud-bot caicloud-bot merged commit 3391994 into caicloud:master Sep 3, 2018
@zhujian7 zhujian7 deleted the templates branch September 11, 2018 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. caicloud-cla: yes Indicates the PR's author has not signed the Caicloud CLA. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants