@@ -5,9 +5,8 @@ import { encrypt } from '../common/crypt'
5
5
import { env } from '../common/envalid'
6
6
import { hfValues } from '../common/hf'
7
7
import { prepareEnvironment } from '../common/setup'
8
- import { currDir , getFilename , OtomiDebugger , setParsedArgs , terminal } from '../common/utils'
8
+ import { getFilename , OtomiDebugger , rootDir , setParsedArgs , terminal } from '../common/utils'
9
9
import { Arguments as HelmArgs } from '../common/yargs-opts'
10
- import { bootstrapGit } from './bootstrap'
11
10
import { Arguments as DroneArgs , genDrone } from './gen-drone'
12
11
import { pull } from './pull'
13
12
import { validateValues } from './validate-values'
@@ -20,10 +19,10 @@ interface Arguments extends HelmArgs, DroneArgs {}
20
19
export const preCommit = async ( ) : Promise < void > => {
21
20
const pcDebug = terminal ( 'Pre Commit' )
22
21
pcDebug . info ( 'Check for cluster diffs' )
23
- await nothrow ( $ `git config --local diff.sopsdiffer.textconv "sops -d"` )
24
- const settingsDiff = ( await $ `git diff env/settings.yaml` ) . stdout . trim ( )
25
- const secretDiff = ( await $ `git diff env/secrets.settings.yaml` ) . stdout . trim ( )
26
-
22
+ cd ( env . ENV_DIR )
23
+ const settingsDiff = ( await nothrow ( $ `git diff env/settings.yaml` ) ) . stdout . trim ( )
24
+ const secretDiff = ( await nothrow ( $ `git diff env/secrets.settings.yaml` ) ) . stdout . trim ( )
25
+ cd ( rootDir )
27
26
const versionChanges = settingsDiff . includes ( '+ version:' )
28
27
const secretSlackChanges = secretDiff . includes ( '+ url: https://hooks.slack.com/' )
29
28
const secretMsTeamsLowPrioChanges = secretDiff . includes ( '+ lowPrio: https://' )
@@ -36,7 +35,6 @@ export const gitPush = async (branch: string): Promise<boolean> => {
36
35
const gitDebug = terminal ( 'gitPush' )
37
36
gitDebug . info ( 'Starting git push.' )
38
37
39
- const cwd = await currDir ( )
40
38
cd ( env . ENV_DIR )
41
39
try {
42
40
await $ `git push -u origin ${ branch } -f`
@@ -46,7 +44,7 @@ export const gitPush = async (branch: string): Promise<boolean> => {
46
44
gitDebug . error ( error )
47
45
return false
48
46
} finally {
49
- cd ( cwd )
47
+ cd ( rootDir )
50
48
}
51
49
}
52
50
@@ -55,7 +53,6 @@ export const commit = async (): Promise<void> => {
55
53
56
54
debug . info ( 'Preparing values' )
57
55
58
- const cwd = await currDir ( )
59
56
cd ( env . ENV_DIR )
60
57
61
58
const values = await hfValues ( )
@@ -68,6 +65,7 @@ export const commit = async (): Promise<void> => {
68
65
await $ `git commit -m 'otomi commit' --no-verify`
69
66
} catch ( e ) {
70
67
debug . error ( e . stdout )
68
+ debug . error ( e . stderr )
71
69
debug . log ( 'Something went wrong trying to commit. Did you make any changes?' )
72
70
}
73
71
@@ -93,7 +91,7 @@ export const commit = async (): Promise<void> => {
93
91
debug . error ( 'Pushing the values failed, please read the above error message and manually try again' )
94
92
process . exit ( 1 )
95
93
} finally {
96
- cd ( cwd )
94
+ cd ( rootDir )
97
95
}
98
96
}
99
97
@@ -108,8 +106,8 @@ export const module = {
108
106
109
107
if ( ! env . CI && existsSync ( `${ env . ENV_DIR } /.git` ) ) {
110
108
await pull ( )
111
- } else {
112
- await bootstrapGit ( )
109
+ // } else {
110
+ // await bootstrapGit()
113
111
}
114
112
await commit ( )
115
113
} ,
0 commit comments