# Resource.json and git

**URL:** <https://forum.inductiveautomation.com/t/resource-json-and-git/38615>\
**Category:** Ignition\
**Tags:** ignition80, perspective, scripting\
**Created:** [September 11, 2020, 8:35pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615 "2020-09-11T20:35:28Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Dan\_Bridgeman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dan_bridgeman/32/3610_2.png) [@Dan\_Bridgeman](https://forum.inductiveautomation.com/u/Dan_Bridgeman)\
**Post date:** [September 21, 2020, 3:28pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/21 "2020-09-21T15:28:40Z")

</div>

Not on the same desktop, they aren’t open. In most cases they haven’t even been opened and closed since the last pull, merge, or commit.

And these are projects where we are not using any Vision resources at all.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 21, 2020, 3:39pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/22 "2020-09-21T15:39:05Z")

</div>

> [@pturmel](#):
>
> IA probably won’t have much luck with source control systems if Ignition noticing a change in the source produces more changes in the source.

> [@pturmel](#):
>
> I’m not sure there is a solution as long as resource.json contains anything other than the actor of the last modification.

The last modification is actor, timestamp, and signature of the resource contents.

Changes made within Ignition should always save without a subsequent scan complaining.

Changes made externally, e.g. with a text editor, likely won't be able to update any of the info, so on the next scan when Ignition notices this resource changed it writes back a modified copy indicating the last modification was external and an updated signature.

This does make things a bit unfriendly for using an external editor, but shouldn't be unfriendly to VCS in general.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 21, 2020, 6:55pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/23 "2020-09-21T18:55:18Z")

</div>

> [@Kevin.Herron](#):
>
> so on the next scan when Ignition notices this resource changed it writes back a modified copy indicating the last modification was external and an updated signature.

No, it should be honoring the actor, timestamp, and signature supplied by the external pull. It should be regenerated only if the external change didn't supply a new resource.json (like a direct edit in the filesystem). Or it should be excluded/excludable from source control.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 21, 2020, 6:58pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/24 "2020-09-21T18:58:36Z")

</div>

> [@pturmel](#):
>
> No, it should be honoring the actor, timestamp, and signature supplied by the external pull.

It will, if the signature is correct.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 21, 2020, 7:20pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/25 "2020-09-21T19:20:51Z")

</div>

How is the signature calculated? If one gateway’s signature won’t be honored by another gateway when the entire resource is replaced, the signature can’t be considered friendly to source control. And if resource content is text (like Perspective), and git successfully merges two independent changes by others, Ignition is going to make another change because neither source signature could be correct. This signature is very unfriendly. I recommend the signature be split into another file and that other file be excluded from source control.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [September 21, 2020, 7:30pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/26 "2020-09-21T19:30:44Z")

</div>

> If one gateway’s signature won’t be honored by another gateway when the entire resource is replaced, the signature can’t be considered friendly to source control.

Yes, you're right, but this _isn't_ how it should work, one gateway's signature _should_ be honored anywhere. The signature calculation is just a hash, it _should_ be completely deterministic regardless of where and when it is calculated. That's why I'm a bit perplexed as to the cause of the behavior described in this thread...

---

<div class="post-metadata">

**Author:** ![joseph.burns](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joseph.burns/32/61584_2.png) [@joseph.burns](https://forum.inductiveautomation.com/u/joseph.burns)\
**Post date:** [October 18, 2020, 6:42pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/27 "2020-10-18T18:42:04Z")

</div>

I ran into the problem again, and it happens reliably for a specific commit. Here’s how to replicate it if anyone is interested:

`git clone https://github.com/jlbcontrols/Flintium.git`  
`git checkout 3c6be9171f5f2ee8356b4f7537f994a84c6f17e3`

At this point, `git status` shows no changes. If you start a new, clean Ignition Gateway with this project, it will show resource.json changes for two scripts. If you have docker-compose you can try it:

`cd ./Flintium/docker/devenv`  
`docker-compose up`

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 18, 2020, 8:24pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/28 "2020-10-18T20:24:37Z")

</div>

This doesn’t really help because as far as Ignition is concerned this behavior is expected.

These 2 resources have incorrect signatures given their contents. It’s expected that Ignition will then update the the last modified timestamp and signature and write that back to the resource.json file.

What would be more interesting is how that incorrect signature got there in the first place. As mentioned previously, if you’re editing the `code.py` files in an external editor then that is likely to lead to you committing with a signature that isn’t correct. If that’s not what’s causing it, then whatever _is_ would be the interesting thing to reproduce.

---

<div class="post-metadata">

**Author:** ![joseph.burns](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joseph.burns/32/61584_2.png) [@joseph.burns](https://forum.inductiveautomation.com/u/joseph.burns)\
**Post date:** [October 18, 2020, 8:42pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/29 "2020-10-18T20:42:42Z")

</div>

That will be tougher to catch! I can tell you it was not edited externally though.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 18, 2020, 8:45pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/30 "2020-10-18T20:45:18Z")

</div>

I wonder if it is inadvertently being modified externally then, or if there is a save bug lurking somewhere, or what… because even the previous version before Ignition catches this incorrect hash and writes it back indicates it was modified externally:

```auto
git diff ignition/script-python/flintiumscripts/administration/tagfiles/exporternode/resource.json
diff --git a/ignition/script-python/flintiumscripts/administration/tagfiles/exporternode/resource.json b/ignition/script-python/flintiumscripts/administration/tagfiles/exporternode/resource.json
index 39467af..ae14213 100644
--- a/ignition/script-python/flintiumscripts/administration/tagfiles/exporternode/resource.json
+++ b/ignition/script-python/flintiumscripts/administration/tagfiles/exporternode/resource.json
@@ -9,8 +9,8 @@
   "attributes": {
     "lastModification": {
       "actor": "external",
- "timestamp": "2020-06-27T16:39:03Z"
+ "timestamp": "2020-10-18T20:18:54Z"
     },
- "lastModificationSignature": "48f6b565e3e26fc5167150c7914227340065a948187dd2617d2990931b8412ac"
+ "lastModificationSignature": "8f40494624197d92c7095b4e88411a6925addc955837c9d28137bf52cc3fc6d3"
   }
 }

```

Of course the previous “external” modification could have just been another case where Ignition corrected an incorrect hash with no other actual changes, but it all had to start somewhere, somehow…

---

<div class="post-metadata">

**Author:** ![joseph.burns](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joseph.burns/32/61584_2.png) [@joseph.burns](https://forum.inductiveautomation.com/u/joseph.burns)\
**Post date:** [October 20, 2020, 2:23pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/31 "2020-10-20T14:23:07Z")

</div>

I agree it sounds like a save bug or an inadvertent external change. I only manipulate these files externally with git commands that change both script and resource.json at the same time to another state with valid signature… checkout, reset, etc.

---

<div class="post-metadata">

**Author:** ![andrea.tidwell](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andrea.tidwell/32/18682_2.png) [@andrea.tidwell](https://forum.inductiveautomation.com/u/andrea.tidwell)\
**Post date:** [March 9, 2021, 9:29pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/32 "2021-03-09T21:29:14Z")

</div>

@joseph.burns, @Dan_Bridgeman - hoping to resurrect this thread. Did you guys find any solutions to this? I’m running into the same problem in our development workflow. We are also using Azure DevOps Git source control and we’re all developing individually on our own gateway instances. We have a batch file in our repo that uses symlink to hard link the local repo files to the Ignition projects directory. I’m getting the same error as you Dan, with multiple resource types (Vision windows, python scripts, Perspective views, etc.) showing a modified resource.json file when I run ‘git status’.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 10, 2021, 12:04am UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/33 "2021-03-10T00:04:02Z")

</div>

There isn’t going to be a solution until IA splits the resource.json into separate files–one that carries resource metadata that supplements but is independent of the resource content, and one that carries the housekeeping for the resource system. The former would be git-merge compatible, the latter would get an entry in `.gitignore`.

Signatures and timestamps and audit traces (any generated material) are fundamentally incompatible with treatment as source-control _content_.

---

<div class="post-metadata">

**Author:** ![joseph.burns](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joseph.burns/32/61584_2.png) [@joseph.burns](https://forum.inductiveautomation.com/u/joseph.burns)\
**Post date:** [March 10, 2021, 2:23pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/34 "2021-03-10T14:23:23Z")

</div>

@andrea.tidwell Unfortunately I haven’t found a solution.

@pturmel I’d like separate metadata as well, but don’t see any reason why it couldn’t work as-is (if it was functioning correctly). There shouldn’t be any phantom changes if no edits were made.

---

<div class="post-metadata">

**Author:** ![Dan\_Bridgeman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dan_bridgeman/32/3610_2.png) [@Dan\_Bridgeman](https://forum.inductiveautomation.com/u/Dan_Bridgeman)\
**Post date:** [March 10, 2021, 2:31pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/35 "2021-03-10T14:31:34Z")

</div>

Same on both counts.

I tried putting resource.json in .gitignore, which went about as well as you’d imagine.

At this point my workaround is to stash the rogue resource.json modifications when I need to pull from the origin or merge from another branch. They come back pretty quickly, but it works well enough. Then when there are enough of them that they’re starting to clutter the status, I commit them by themselves, so they don’t confuse any actual code changes.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 10, 2021, 10:34pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/36 "2021-03-10T22:34:35Z")

</div>

> [@joseph.burns](#):
>
> but don’t see any reason why it couldn’t work as-is

> [@pturmel](#):
>
> fundamentally incompatible

Perhaps I wasn't clear?

---

<div class="post-metadata">

**Author:** ![joseph.burns](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joseph.burns/32/61584_2.png) [@joseph.burns](https://forum.inductiveautomation.com/u/joseph.burns)\
**Post date:** [March 11, 2021, 1:20am UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/37 "2021-03-11T01:20:54Z")

</div>

Just a bit vague. The current system is acceptable when it works. A new timestamp doesn’t bother me if the associated file actually changed.

---

<div class="post-metadata">

**Author:** ![Dan\_Bridgeman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dan_bridgeman/32/3610_2.png) [@Dan\_Bridgeman](https://forum.inductiveautomation.com/u/Dan_Bridgeman)\
**Post date:** [March 11, 2021, 6:11pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/38 "2021-03-11T18:11:54Z")

</div>

I could see it working if resource.json only changed when the cksum of code.py (or whatever) had changed, but it seems to be using timestamps. And in theory this could work, but something seems to touch the code files in a way that changes their timestamps. It would lead to less hair-pulling if it were at least consistent, but I’ve not been able to find a rhyme nor reason behind it.

Of course the cksum method would only work if everyone agreed on the same whitespace and EOL formatting, but I believe you can configure git to standardize all that.

---

<div class="post-metadata">

**Author:** ![ken.maze](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ken.maze/32/85876_2.png) [@ken.maze](https://forum.inductiveautomation.com/u/ken.maze)\
**Post date:** [November 24, 2021, 9:34pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/39 "2021-11-24T21:34:28Z")

</div>

I’m having a similar problem with subversion. I get a lot of conflicts on the resource.json files when I try to check in. In this case, I notice that SVN shows a login time of 11/21/2021 6:07 PM. Then when I go to check the file timestamp, it is showing 11/21/2021 6:01 PM, six minutes before the checkin, so SVN believes a file conflict happened, and I have to go through a nerve-wracking process of un-conflicting everything. I guess it’s a little les nerve-wracking now that I understand more about what is happening

---

<div class="post-metadata">

**Author:** ![Scott\_James](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@Scott\_James](https://forum.inductiveautomation.com/u/Scott_James)\
**Post date:** [June 17, 2022, 4:30pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/40 "2022-06-17T16:30:27Z")

</div>

Any traction or addition suggestions on this topic? When going through a code reviews it is very tedious to have to scroll through 400 changes to find the 1 file with the 1 line of code changed.

[Previous page](https://forum.inductiveautomation.com/t/resource-json-and-git/38615.md?page=1)

[Next page](https://forum.inductiveautomation.com/t/resource-json-and-git/38615.md?page=3)
