I can’t do anything after I enabled “Config-as-code”, it enabled it in background but there are errors. So when I open the project it complains -
There was an error accessing version control.
If I go to Settings → Version control, it shows enabled. but when I Test it, fails with error -
“Branch ‘main’ does not exist on the repository.”
If I update the branch to “master”, it fails with below error -
The file 'schema_version.ocl' does not exist in the Git repository.
Thanks for getting in touch, though my apologies that you’re hitting this unexpected roadblock after enabling config as code feature on this project. I’ve attempted to reproduce this one (with some assumptions) though I haven’t had any luck doing so. Could you let me know the version of Octopus you’re currently running? Since this feature is still relatively new, there have been a large number of fixes since it was first shipped, so if you’re on an older version (2022.3 (Build 10594) is the current latest available for download) it’s possible an upgrade will fix this.
My attempts to reproduce this issue involved creating the repo and additional branches within prior to converting my project in Octopus to config as code then pointing it to the other empty branch, converting another project pointing to other branches, etc. Do you see any ocl files in any branches in this repo your project is pointing at? Would you be willing to send through a screenshot showing your version control configuration in your project? You can upload that at this upload link.
I look forward to hearing back and getting to the bottom of this one.
Thanks for your reply Kenny.
I am currently on 2022.1.2679 version.
I have also added screenshots
I don’t see OCL files or .octopus folder in git
“Test” button returns success on version control page in octopus.
Thank you for following up quickly, and for uploading your screenshots. They look perfectly fine, and mimicking it locally was successful on my end. Could you try clearing your local git cache from Octopus (in your web portal under Configuration > Git) and let me know if that sorts this out?
My best guess at this early stage is this might be related in some way to another known (and since fixed in 2022.3.6507) bug that I’ll link below.
Thanks for getting in touch, though I’m sorry to see that didn’t help. Could you provide details about the new errors you’re seeing after clearing the cache? I’m hoping that’ll help narrow the search down a bit.
Just reading this to get a response out to you as Kenny is off shift as part of our AUS based team.
I noticed I just replied to another ticket of yours here. Is this the same issue with the same project? If so am I able to close one of the tickets as it can get confusing if we are trying to fault find the same issue on two tickets.
In my response on that other ticket I asked you to clear the Git Cache which, when reading this one, it looks like you already did this, is this the case and you are still getting the schema_version.ocl file does not exist in the Git Repository?
Do you have any files in there at all? If you have the .octopus folder in there it may be worth going into that and trying to manually create a blank schema_version.ocl file and see if that fixes the issue.
If there are no files in there at all can you check the permissions in the repo and make sure the account you are using in Octopus to connect to that Git Repo has the correct permissions. We have the permission list you need here.
Let me know if any of those suggestions help and if this is the same job as the other ticket I will close the other one and we can focus on this ticket to see if we can get that project up again.
Thanks @clare.martin for your response, yes its same issue. There are no files in Git at all, not even a .octopus folder. I just assigned the Admin permissions to the user now, though user was already Org Owner. however still getting similar errors. Its the same job as other ticket, however my question on other ticket was mainly about how to turn off the CaC.
Thank you for confirming that, ill set the other ticket to solved and we will work on this one if that is ok. CaC is a one-way feature as Daniel mentioned unfortunately.
Lets try and get this working for you, I took a look in our support files and noticed you posted two files yesterday showing your config as code setup. Initially I thought maybe having dots in your repo name would cause an issue but I just created a new repo called Clare.Test.CaC and its converted one of my projects fine and put all the files in there so the issue you are experiencing is confusing.
Have you just got one project you have converted to CaC or is this the first one you have converted? If you have others have they converted fine?
On the other ticket you mentioned you are going to try manually clearing out the Git folder. If that does not work can we get the HAR file and Octopus Server logs I mentioned in that ticket and we can take a look for you to see if we can see why this is happening.
The error shown in that GitHub issue is what you are seeing so I am wondering if you could try and implement the workaround to see if that gets you up and running, the workaround is to merge the changes from the initial commit branch into the default branch.
I am wondering if you have a few different branches in your repo and accidentally committed your initial conversion of the project to a non-default branch?
If you have no OCL files in any of your branches for this project then ignore what I have mentioned and let me know once you have tested the manual Git clear and if you want to send us over some logs.
Thank you for those logs, I have had a look at both, the server logs are showing that you can connect to the GIT repo fine (with a 200 response code). But then when it comes to accessing the project itself its throwing up the schema error you mentioned in this ticket.
Looking at the HAR trace for that project I can see it errors out with a 400 response which means there is a bad request (because it cannot find a deployment process OCL file in the repository it is looking in).
I have discussed this with the other members of our support team as none of us have seen this happen before so its a strange one. Because you have no OCL files in the repository at all, unfortunately we think that project is not recoverable.
Do you take regular backups of your DB and would you be able to restore one to a test VM at all? If so you can recover your project from the DB backup. You could actually use that and convert it to CaC using the same repo. That should then create the files required and your current project on your live instance would then start working!
I cannot say what went wrong here, the only thing I can think is you setup CaC on the project and it bombed out before it had the chance to create the OCL files, so the project was converted but no files were created. We have never seen this happen before so it is a bit strange!
If the DB backup project also errors out and doesn’t create the files it might be worth looking at that repo and possibly deleting it and creating a new one from scratch with just the default (main) branch. I would delete your ‘master’ branch in your current repo anyway so you only have one branch (main) for the initial setup.
Let me know how you get on, if you don’t have any DB backups that are usable I am sorry to say that project is gone. We do recommend cloning a project to test this on before hand if this is the first time you are playing with CaC to make sure the process runs smoothly but this looks like an anomaly as it seems you have everything setup correctly.