Initial bricks init add to .gitignore

This commit is contained in:
Shreyas Goenka 2022-10-17 15:50:23 +02:00
parent 38a9dabcbe
commit 1733c7d11f
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
2 changed files with 22 additions and 0 deletions

View File

@ -111,6 +111,21 @@ var initCmd = &cobra.Command{
if err != nil { if err != nil {
return err return err
} }
// Create .gitignore if absent
gitIgnoreFile, err := os.OpenFile(fmt.Sprintf("%s/%s", wd, project.GitIgnoreFile),
os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
if err != nil {
return err
}
defer gitIgnoreFile.Close()
// Append .databricks to the end of .gitignore file
_, err = gitIgnoreFile.WriteString("\n/.databricks/")
if err != nil {
return err
}
d, err := templates.ReadDir(".") d, err := templates.ReadDir(".")
if err != nil { if err != nil {
return err return err

View File

@ -24,6 +24,13 @@ const (
// ConfigFile is the name of project configuration file // ConfigFile is the name of project configuration file
const ConfigFile = "databricks.yml" const ConfigFile = "databricks.yml"
// Cache Dir is the name of the directory with all the state overrides,
// cached artifacts and per-user state
const CacheDir = ".databricks"
// Name of the file with regexes that are not to be checked into git
const GitIgnoreFile = ".gitignore"
type Assertions struct { type Assertions struct {
Groups []string `json:"groups,omitempty"` Groups []string `json:"groups,omitempty"`
Secrets []string `json:"secrets,omitempty"` Secrets []string `json:"secrets,omitempty"`