Skip to content

Commit

Permalink
updating readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
akhettar committed Jul 7, 2020
1 parent 635498a commit befbf50
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
This tool generate CI config for any given CI tool (Github Action, Circleci) from a given generic CI template. It ensures consistency of the CI template across all the deployments. This tool is particularily useful in the era of microservices architectural style whereby several microservices would share the same deployument pipeline. This tool allow to generate ci config for all these services from a one given ci template. See diagram below for the detailed flow:


![illustaration](illustration.png)


## Why should you use this tool?

Expand Down
2 changes: 1 addition & 1 deletion examples/github-action/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Sample CI Templater project

This is a sample ci templater project. Creates a similar
This is a sample ci templater project. Creates a similar directory structure and download the binary from the [latest release from here](https://github.com/akhettar/ci-templater/releases/)
32 changes: 30 additions & 2 deletions generator.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
/*
MIT License
Copyright (c) 2020 akhettar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package main

import (
Expand Down Expand Up @@ -163,11 +185,18 @@ func renderTemplate(repo Repository, repoLocation string) error {
//overwrite the config file with the template
filePath := fmt.Sprintf("%s/.github/workflows/%s", repoLocation, filepath.Base(path))
log.Printf("processing template: %s", filePath)
fileToWrite, err := os.Create(filePath)

banner, err := ioutil.ReadFile("banner")

fileToWrite, err := os.OpenFile(filePath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
fileToWrite.Write(banner)

if err != nil {
log.Fatalf("failed to render the template, error: %v", err.Error())
return err
}
defer fileToWrite.Close()

if err = t.Execute(fileToWrite, repo); err != nil {
return err
}
Expand Down Expand Up @@ -228,7 +257,6 @@ func validate() {
os.Setenv(GithubAuthToken, *token)
os.Setenv(GithubEmail, *email)
os.Setenv(DryRun, *dryrun)

}

func clearUp(path string) {
Expand Down
22 changes: 22 additions & 0 deletions git.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
/*
MIT License
Copyright (c) 2020 akhettar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package main

import (
Expand Down
Binary file added illustration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
/*
MIT License
Copyright (c) 2020 akhettar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package main

func main() {
Expand Down

0 comments on commit befbf50

Please sign in to comment.