If you are running magento2 on multiple servers, and deploying static content.
It will create a "deployed_version.txt" with a number in pub/static.
Now if this number is different from different servers (and you are running varnish/etc in front) it will fail to get the content from that server.
deployed_version just contains a timestamp so if they are not deployed at the exact second, it will be missed.
Example
Server1 - deployed_version.txt contains: 1
Server2 - deployed_version.txt contains: 2
Now it will try to fetch https://example.com/static/1/file.js from server 1 - Everything is fine - But then it will try and fetch https://example.com/static/1/secondfile.js from server 2 - which does not exists (because the deployed version number is 2) and throws a 404.
Copy deployed_version.txt (or the content) from 1 server and then insert it in all servers just before deployment.
The js/css/etc files does not needs to be changed, and no folders needs to be changed, just that number in that file.
bin/magento setup:static-content:deploy has a parameter --content-version=CONTENT-VERSION which I think the recipe should automaticcly set use
Custom version of static content can be used if running deployment on multiple nodes to ensure that static content version is identical and caching works properly.
Can we use timestamp on local machine to set content version?
Can we use timestamp on local machine to set content version?
I see no problem in doing that. The actual content doesn't really matter, as long as it's the same across all servers.
the CONTENT_VERSION parameter could actually be anything - time() or git hash - Only requirements is that it its the same on all servers at each deployment.
git hash might not be the best idea - if you really want to push changes without adding a git push - you might end up with some cached static - Though Im not really sure why you want to clear the cache, without pushing to git.
Most helpful comment
I see no problem in doing that. The actual content doesn't really matter, as long as it's the same across all servers.