@codefresh-io/pipeline-autobot
v1.7.3
Published
Generate yaml depend on repo context
Downloads
84
Maintainers
Keywords
Readme
Repository analyzer
About
Component for analyze github repository use github statistic API and generate codefresh steps according repo info.
Content
Usage
Examples how use repo analyzer
Run analyzer without cf integration
Run test.js with envs
PASSWORD=****2
REPO_OWNER=codefresh-io
REPO_NAME=pipeline-manager
GIT_CONTEXT=github
Run analyzer using CLI
https://codefresh-io.github.io/cli/analyzer/
Example of analyzer flow
analyzer
.step(clone)
.step(build)
.step(push)
.step(packageJson)
.header(stages)
.enrich(stagesEnricher)
.transform(codefreshYaml)
.resolve()
Handler types that analyzer support
Transformers - ability to transform from some info to whole yaml file , use cases :
- Check that repo contain codefresh.yaml (source github context -> output codefresh yaml path)
- Convert from gitlab to codefresh yaml (source github context -> output codefresh yaml with steps) Important : after transformer execution if we have result we terminate whole chain (not make any sense to continue)
Headers - ability to add some yaml parts before
steps
key use cases:- Add codefresh yaml stages
- Add yaml version
Steps - ability to add some step to generated pipeline, like git clone, build, notifications, etc
Enricher - ability to enrich each step some additional information, like stage for each step
Adding new handler
For add new handler you should create .js in related folder (like analyzer.steps)
Each step has as input analyzer.context (you can access from it githup api, credentials, everything that you need)
module.exports = (context) => {
const { repo: { repoOwner, repoName, branch } , git } = context.getContext();
return {
step : {
type: 'git-clone',
description: 'Cloning main repository...',
repo: `${repoOwner}/${repoName}`,
revision: branch,
git
},
key: 'clone',
group: 'clone'
};
};
Where
key
- it is step name
group
- logical group, like test, linters, etc, will be helpful in future . (For now using it for stages)