Title
#general
k

Karolis Zivulskas

08/18/2022, 6:48 AM
Hi! Has anyone had an issue where for the first time merge request for Infracost comment works fine but during the second time this error occurs?fatal: destination path '/tmp/base' already exists and is not an empty directory. Any tip would be appreciated.
Vadim (Infracost)

Vadim (Infracost)

08/18/2022, 7:28 AM
Hello! Based on our yesterday's discussion, it seems that your local machine already has
/tmp/base
directory after the first run and it's not cleaned up
7:29 AM
To mitigate that you could add a last step to the pipeline config to delete this directory
7:31 AM
Usually the pipeline job is running in a container, so the directory is located in there, and we don't need to worry about the cleanup as the container gets discarded.
7:32 AM
After the line with
infracost comment gitlab
command you can add a new line with something like
- rm -rf /tmp/base
as a last step
7:33 AM
FYI, this folder is created on
git clone
step to pull your base branch - it is needed to create a baseline for comparison
k

Karolis Zivulskas

08/18/2022, 8:19 AM
Looks like it worked in that form:
- Remove-Item -Recurse -Force /tmp/base
After the changes are made for existing merge request, will additional comment from Infracost appear?
Vadim (Infracost)

Vadim (Infracost)

08/18/2022, 8:20 AM
Oh, sorry, I guess Windows should have a different command 🙂
8:21 AM
The
infracost comment
command has a
--behavior
flag that supports 3 options:
new
,
update
,
delete-and-new
, where
update
is default. Update means it will update content of its latest comment
8:23 AM
If you follow our example, its behavior is set to
update
k

Karolis Zivulskas

08/18/2022, 8:30 AM
I somehow missed this part. Hour by hour I like Infracost more and more 🤓
Vadim (Infracost)

Vadim (Infracost)

08/18/2022, 8:31 AM
Hope you're enjoying using it 🙂