@@ -50,20 +50,39 @@ const commitAndPush = async (values: Record<string, any>, branch: string): Promi
50
50
return
51
51
}
52
52
if ( values . _derived ?. untrustedCA ) process . env . GIT_SSL_NO_VERIFY = '1'
53
- d . log ( 'git config:' )
54
- await $ `cat .git/config`
55
- await $ `git push -u origin ${ branch } `
53
+ await retry (
54
+ async ( ) => {
55
+ try {
56
+ cd ( env . ENV_DIR )
57
+ await $ `git push -u origin ${ branch } `
58
+ } catch ( e ) {
59
+ d . warn ( `The values repository is not yet reachable. Retrying.` )
60
+ throw e
61
+ }
62
+ } ,
63
+ {
64
+ retries : 20 ,
65
+ maxTimeout : 30000 ,
66
+ } ,
67
+ )
56
68
d . log ( 'Successfully pushed the updated values' )
57
69
}
58
70
59
- export const commit = async ( ) : Promise < void > => {
71
+ export const commit = async ( initialInstall : boolean ) : Promise < void > => {
60
72
const d = terminal ( `cmd:${ cmdName } :commit` )
61
73
await validateValues ( )
62
74
d . info ( 'Preparing values' )
63
75
const values = ( await hfValues ( ) ) as Record < string , any >
64
- // we call this here again, as we might not have completed (happens upon first install):
65
- await bootstrapGit ( values )
66
- const { branch, remote } = getRepo ( values )
76
+ const { branch, remote, username, email } = getRepo ( values )
77
+ if ( initialInstall ) {
78
+ // we call this here again, as we might not have completed (happens upon first install):
79
+ await bootstrapGit ( values )
80
+ } else {
81
+ cd ( env . ENV_DIR )
82
+ await setIdentity ( username , email )
83
+ // the url might need updating (e.g. if credentials changed)
84
+ await $ `git remote set-url origin ${ remote } `
85
+ }
67
86
// lets wait until the remote is ready
68
87
if ( values ?. apps ! . gitea ! . enabled ?? true ) {
69
88
await waitTillGitRepoAvailable ( remote )
@@ -100,7 +119,7 @@ export const cloneOtomiChartsInGitea = async (): Promise<void> => {
100
119
await $ `rm -f .gitignore`
101
120
await $ `rm -f LICENSE`
102
121
await $ `git init`
103
- await setIdentity ( username , password , email )
122
+ await setIdentity ( username , email )
104
123
await $ `git checkout -b main`
105
124
await $ `git add .`
106
125
await $ `git commit -m "first commit"`
@@ -222,6 +241,6 @@ export const module = {
222
241
handler : async ( argv : Arguments ) : Promise < void > => {
223
242
setParsedArgs ( argv )
224
243
await prepareEnvironment ( { skipKubeContextCheck : true } )
225
- await commit ( )
244
+ await commit ( true )
226
245
} ,
227
246
}
0 commit comments