auditdeploy / builder Goto Github PK
View Code? Open in Web Editor NEWNext-Gen Builder
Home Page: https://www.getbuilder.io/
License: Apache License 2.0
Next-Gen Builder
Home Page: https://www.getbuilder.io/
License: Apache License 2.0
The parent folder will be the project name. The parent folder will have a hidden, read-only folder that contains the source code of the project, a workspace folder that contains a copy of the source code along with any files/folders generated during the build process, and a (possibly hidden) log folder for all builds within the project.
This interface will allow for third party CLI and applications/SDK to integrate directly into Builder to remove the need to pipe or add Builder to custom scripts.
this should post a json or possibly a yaml file with all relevant build info to a specified url.
In the setting we need to enable a flag auto-push. This flag would automatically push build metadata after every build attempt.
once this is configured it should be enabled by default to true. However once it has manually been set to false it will manually need to be set back to true.
buildcmd
is provided Builder should use it as the build commandbuildfile
is provided without a buildcmd
Builder should use the build file with the default build commandbuildfile
and a buildcmd
is provided Builder should use the build command givenbuildtool
(where user is specifying make, gradle, maven, etc.) is provided, Builder should use the build steps defined for the specified tool (i.e. if "maven" or "mvn" is provided as the build tool, Builder should run the command mvn clean install
)Command init clones project from source control, derives the project type and installs dependencies.
Build a builder default feature that will allow storage of parameters in builder.yaml so we don't have to pass them to command line. If parameters are passed to command line, overwrite their values in builder.yaml file
Add section for these parameters in builder.yaml
When we try to build a project it's not build the project as files are not copied from the .hidden
directory to the workspace
directory.
There are cp
command is used for copy project files in utils/copyDir.go
file but it's not working on the Windows platform.
https://github.com/AuditDeploy/Builder/blob/main/utils/copyDir.go#L17
Suggestion:
We can use https://github.com/otiai10/copy which provides functionality to copy files recursively independent of the platform.
Or We can use the below function which works fine on my Windows machine but not sure about other platforms. We have to test code on other platforms.
func CopyDirectory(scrDir, dest string) error {
entries, err := ioutil.ReadDir(scrDir)
if err != nil {
return err
}
for _, entry := range entries {
sourcePath := filepath.Join(scrDir, entry.Name())
destPath := filepath.Join(dest, entry.Name())
fileInfo, err := os.Stat(sourcePath)
if err != nil {
return err
}
// stat, ok := fileInfo.Sys().(*sys.Stat_t)
// if !ok {
// return fmt.Errorf("failed to get raw syscall.Stat_t data for '%s'", sourcePath)
// }
switch fileInfo.Mode() & os.ModeType {
case os.ModeDir:
if err := CreateIfNotExists(destPath, 0755); err != nil {
return err
}
if err := CopyDirectory(sourcePath, destPath); err != nil {
return err
}
case os.ModeSymlink:
if err := CopySymLink(sourcePath, destPath); err != nil {
return err
}
default:
if err := Copy(sourcePath, destPath); err != nil {
return err
}
}
// if err := os.Lchown(destPath, int(stat.Uid), int(stat.Gid)); err != nil {
// return err
// }
isSymlink := entry.Mode()&os.ModeSymlink != 0
if !isSymlink {
if err := os.Chmod(destPath, entry.Mode()); err != nil {
return err
}
}
}
return nil
}
func Copy(srcFile, dstFile string) error {
out, err := os.Create(dstFile)
if err != nil {
return err
}
defer out.Close()
in, err := os.Open(srcFile)
if err != nil {
return err
}
defer in.Close()
_, err = io.Copy(out, in)
if err != nil {
return err
}
return nil
}
func Exists(filePath string) bool {
if _, err := os.Stat(filePath); os.IsNotExist(err) {
return false
}
return true
}
func CreateIfNotExists(dir string, perm os.FileMode) error {
if Exists(dir) {
return nil
}
if err := os.MkdirAll(dir, perm); err != nil {
return fmt.Errorf("failed to create directory: '%s', error: '%s'", dir, err.Error())
}
return nil
}
func CopySymLink(source, dest string) error {
link, err := os.Readlink(source)
if err != nil {
return err
}
return os.Symlink(link, dest)
}
And do the below changes in the copyDir()
function.
func CopyDir() {
//copies contents of .hidden to workspace
hiddenDir := os.Getenv("BUILDER_HIDDEN_DIR")
workspaceDir := os.Getenv("BUILDER_WORKSPACE_DIR")
err := CopyDirectory(hiddenDir, workspaceDir)
if err != nil {
log.Println("Error in copy hidden directory.")
log.Println(err)
}
}
Thanks
The current builder init command clones a repo and then sticks it in a hidden directory.
This needs to change so that a builder init git_repo_url works similar to a git clone and create a folder name that matches the git project in the current directory.
We can add a param called builder init -h or --hidden. to keep it in a hidden folder. (IE this flag should use the current code in place)
What data is required in the builder.yaml file? How should this data be organized?
Some things we will definitely have:
exec name: the tool building the code (ex: npm, maven)
exec path: path on the user/agents machine to the exec
version: version of exec to use for the build
Currently if a relative path is provided for the output path, the metadata will also reflect that relative path. This new fix will make sure that if the output path is relative, it is seen as relative to the project folder and is converted to an absolute path before being stored in the metadata file.
Update builder push command to do the following:
--save
flag should update the builder.yaml file with the url provided--remove
flag should remove the url from the builder.yaml fileI've downloaded builder tools from your website and tried to build node project.
But it failed.
C:\Users\Administrator\Documents\builder-windows>builder.exe init https://github.com/johnpapa/node-hello
panic: assignment to entry in nil map
goroutine 1 [running]:
Builder/utils.StoreBuildMetadataLocally()
Builder/utils/metadata.go:273 +0xfd
Builder/cmd.Init()
Builder/cmd/init.go:42 +0x131
main.main()
Builder/main.go:21 +0x5e
Need a cross platform application GUI for builder - using something like NodeGui or Electron (I am open to options here)
I would like for this data to be displayed of basic html css and javascript => clientside meaning it doesn't need a web server running to display the content.
It should have a few of each project and be able to run a build and display all of the build metadata
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.