Skip to content

Commit a320d3d

Browse files
committed
_state fix in write mode
1 parent cd854d8 commit a320d3d

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

src/tfstate/git/read-state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export async function pullStateForTerraform({
8686
}
8787

8888
// pull the latest changes from _state branch
89-
// (required in environments where _state is persisted)
89+
// (required in environments where _state is persisted to disk)
9090
// eg. cndi show-outputs locally
9191
try {
9292
await git.pull("origin", "_state");

src/tfstate/git/write-state.ts

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -116,26 +116,13 @@ export async function pushStateFromTerraform({
116116
}
117117

118118
// pull the latest changes from _state branch
119-
// (required in environments where _state is persisted)
119+
// (required in environments where _state is persisted to disk)
120120
// eg. cndi show-outputs locally
121121
try {
122122
await git.pull("origin", "_state");
123-
} catch (errorPullingState) {
124-
if (errorPullingState instanceof Error) {
125-
return new ErrOut(
126-
[
127-
ccolors.error("failed to pull state from _state branch"),
128-
ccolors.error("likely because you have no _state branch"),
129-
ccolors.error("or your _state branch is not up to date"),
130-
],
131-
{
132-
code: 1005,
133-
label,
134-
id: "read-state/pull-state/!pull",
135-
metadata: { cmd, originalBranch },
136-
},
137-
);
138-
}
123+
} catch (_errorPullingState) {
124+
// this can fail if _state branch does not exist
125+
// carry on anyway
139126
}
140127

141128
const encryptedState = await encrypt(state!, secret);

0 commit comments

Comments
 (0)