Hi there,
I have the case where a directory that's committed to BitBucket only contain links that's pointing to some of the share in the filesystem. How can I write a pre-hook script in scriptRunner to check for all the links and make sure those links are from a defined/dedicated location and not from somewhere else that we are not expected?
Thank you for your help.
Kha
Hi @Kha Hoang ,
Please can you provide an example use case, to help us answer your question?
Kind regards,
Robert Giddings,
Product Manager, ScriptRunner for Bitbucket
Hi Robert,
Let's say I have this set of directory
dir1/dir2/file1.txt
dir1/dir2/file2.txt
dir1/dir2/file3.txt ..............> /root/proj/somefile1.txt
dir1/dir2/file4.txt ..............> /root/proj/subpro/somefile1.txt
dir1/dir2/file5.txt ..............> /mylocal/proj/somefile1.txt
As you see file1 and file2 are real files, file3, 4, and 5 are links some other filesystem
I am expect all the links should come from /root; however, file5.txt is from /mylocal/ and I want a pre-hook to fail/reject the commit so that end-user have to go back to fix it.
Thanks,
Kha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kha Hoang ,
If I understand correctly, for example:
/mylocal/proj/somefile1.txt
is the contents of file:
dir1/dir2/file5.txt
And you want to verify the contents "/mylocal/proj/somefile1.txt", is correct? Which in this case, it is not, as the contents should read "/root/proj/somefile1.txt"?
Thanks,
Robert Giddings,
Product Manager, ScriptRunner for Bitbucket
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kha Hoang ,
OK, great.
The ScriptRunner for Bitbucket team are looking into providing examples regarding file checking, for a range of use cases.
I should have an update in the New Year.
Kind regards,
Robert Giddings,
Product Manager, ScriptRunner for Bitbucket
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kha Hoang ,
Further to my previous answer, we have now published a Script to our Adaptavist Library that shows an example of blocking commits based on file content.
The Script can be found here: https://library.adaptavist.com/entity/block-commits-for-files-containing-content-that-doesnt-match-regex
Kind regards,
Robert Giddings,
Product Manager,
ScriptRunner for Bitbucket
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.