creating a readthedocs.io repo in sync with a public gitlab repo - gitlab

I have a public gitlab project here
https://gitlab.com/parmentelat/minisim2
I tried to add a corresponding project in readthedocs.io, so that a new commit being pushed onto gitlab triggers a doc rebuild on readthedocs
I do this routinely with projects hosted at github and it's really easy - at least under my setup - since readthedocs shows me an updated list of github repos right away, and everything goes smoothly after that.
When trying to import this gitlab project under readthedocs though, I have to chose 'Import manually' as my gitlab projects would not show up.
(In the 'connected services' of my readthedocs settings page, I could find a way to connect to github and to bitbucket; gitlab does not seem supported)
Fair enough, I try this manual import, but at that point no matter how I try to spell the project's URL and what method (git or https) I try to use for importing the project, I get this error message
This repository doesn't have a valid webhook set up. That means it won't be rebuilt on commits to the repository.
You can resync your webhook to fix this.
is what I am trying to do doable at all ?
do I need to do something specific on the gitlab side
thanks for any hint

You can manually set the webhook on gitlab.com:
Click the settings icon for your project
Select "Integrations"
Enter the above URL, select "Push events" and "Enable SSL verification"
Click "Add Webhook"
That should do it.

Related

YouTrack Gitlab integration creates wrong URL for commit hash

I've set up integration between YouTrack and Gitlab, and it is (mostly) working as expected.
We have multiple Youtrack project -> Gitlab Repo mappings configured, with the correct URL for the gitlab server.
When I add a commit hash into the comments, then YouTrack correctly identifies this as a commit hash, and turns it into a clickable link.
However, this link points to https://[youtrackserver]/[reponame]/commit/[commithash] where it should instead be pointing to https://[gitlabserver]/[reponame]/commit/[commithash]. As a result, clicking on it give a 404.
In the past, this has worked (with the commithash URL pointing to the gitlab server), and then ceased to work, and then worked again. I have no idea why, though we have had several upgrades of Youtrack in that time.
We can also set a one-to-many mapping from Youtrack Project to Gitlab Repos. If I do this, then the generate commit hash link URL becomes https://[youtrackserver]/rest/gitHub/checkCommit?issueId=[ticket]&sha=[commithash] . Clicking this simply gives a page with nothing on it but 'NotFound'.
How can I configure this to allow the commithashes to have a working URL?

I have accidentally deleted a page from Azure DevOps Wiki. How can I recover it?

I have accidentally deleted a Wiki-page from our repository in Azure DevOps.
(How) can I recover it?
That is not an option for us, since we will loose many changes that
were made after the last version no. up until the date I accidentally
deleted the wiki page.
You can choose Clone wiki to download the wiki repo to local machine.
Then use git commands(git revert or what) locally to get the deleted page, once you find the deleted page, publish it and add it back to Wiki page as a new commit.
I was just able to do this without too much fanfare. The resource that was helpful was this VS community topic. There is an answer that provides a solution that doesn't require you to clone the repo.
The key insight is that you can navigate to the Azure DevOps repo UI for the Git repo that's backing the wiki. The solution author says that the shape of the URL is something like https://dev.azure.com/<organization-name>/<project-name>/_git/<wiki-name>.wiki. This didn't quite work for me because we have a different URL scheme in our organization, but I was able to figure it out after a little trial and error. I later saw that you can get the URL by using the Clone Repo UI in the wiki - it gives you the URL, so you can just copy it and navigate to it.
Anyway, the steps were:
Figure out the URL of the git repo that backs the wiki
Navigate to the revision history for the entire wiki
the current UI shows you the Contents tab by default - switch to History
Scroll until you find the commits that deleted the pages you want to restore
it's one of those list views that populate themselves as you scroll, so you won't be able to use the browser page search efficiently, unfortunately
Revert the commits
In my case, this required clicking on them and creating pull requests to revert, but I was able to merge them myself without involving code reviewers. YMMV
All in all, not a wholly terrible experience, but completely undiscoverable.
Assuming you're managing a provisioned wiki (vs using published code as a wiki):
Look in the top-right corner for the vertical 3-dot menu, where there's an option to view revisions:
Choose the revision you want to revert to (e.g. the one prior to deleting the needed wiki page), from the list (click on its version hash):
From the revision details, select "Revert":
At this point, your wiki should be at its prior state, and your wiki page should once again be available.
Note: If you're using published code as a wiki, you would recover/revert your changes as you would with any other code commit.
More details may be found here.
I couldn't find a way to do this through the Azure DevOps web interface but you can restore the page by reverting the commit that deleted it if you clone the wiki locally.
Clone the wiki to your computer - find the clone wiki option in the menu at the top of the left bar which shows the wiki contents, copy the URL and use to clone locally using your usual git client.
Find the commit that deleted the page, the commit message will start with "Deleted page" then the name of the page you deleted.
Restore the page and commit the change. There are various ways to do this - I reverted the commit, you could checkout the commit and copy the page out to make a new commit. You may get a merge conflict on '.order', I'm not sure what the best thing to do is but I kept the current version and haven't had any problems.
Push the changes to Azure DevOps, refresh and you'll see the page has been restored.
This works even for Project Wikis. I wonder if Azure DevOps has added the functionality that enabled this since some of the other answers have been written.

Integration between GitLab.com (Code) and Hosted GitLab server (Wiki/Issues/CI/CD)

I have a business use-case from a startup to maintain all code repositories on GitLab.com SaaS. And all other services like Wiki, Issue Tracking, CI/CD on a Self-managed/Hosted GitLab.
I could not find any references or examples of such scenario. Is this kind of integration possible. Any references or links would be helpful.
This is absolutely possible, but there are a number of steps you have to take to get it set up.
As an admin on your self-hosted Gitlab installation, go into the Admin area, then Settings, then General, and expand Visibility and Access Controls. Then under Import Sources select all the sources you want to allow your users to import projects from. For this use case, make sure you select at least Gitlab.com.
Next you have to integrate your self-hosted Gitlab instance with Gitlab.com by following the instructions here.
Once all of this is done, go to the Projects page in your self-hosted Gitlab, and hit the green New Project button. You should see three tabs across the top of the New Project page, with the one on the right called Import Project. Click that tab, hit the button for Gitlab.com, and follow the instructions on the page.
Once all that is done, your developers can do all the source control activites on gitlab.com, and all changes will be synced to your self-hosted gitlab for issues, wiki's, and CI/CD.

How to run GitLab CI pipeline on every push to GitHub?

I created a GitLab "CI/CD for external repo" and linked my GitHub.
I then set up mirroring to Pull from that GitHub.
I would have expected when I push to my GitHub, it would show the latest code in the GitLab and automatically start running my GitLab CI pipeline right away, but I noticed this only happens after about 1 hour delay, so I've been pressing the "Update Now" button every time.
This is extremely inconvenient, so am I missing a step to have it simply get the latest code and run the pipeline on every push to GitHub?
When mirroring a GitHub repository using GitLabs "CI/CD for external repo" feature, you must use an account with admin access on the GitHub repository so that GitLab can use your credentials to set up a web hook, which will notify GitLab when there are changes to be pulled.
The webhook URL will look like https://gitlab.com/api/v4/projects/12345678/mirror/pull. I don't think you can create this manually as it needs to be set up with a secret, so you probably need to remove the project from GitLab and reconnect it.

How to disable the creation of new GitLab repositories on push?

In 10.5, GitLab added support to create projects (repositories) by pushing into a namespace (a.h.a group). I would like to disable that feature for my whole instance, but I can't find where to do it. There also no documentation about a disable switch.
How to disable the creation of new repositories on push?
Background:
I moved a repository to another namespace, but a cloned version on some random PC is sometimes pushing to the old repository URL. Because it was moved, the developer gets no error message or warning, but he create a new repository on the server.
I found the developer and his PC and we changed the repository URL, but I still would like ti disable this feature for the future.
Linked Issues:
Add group setting to allow or disallow "Push to create project"
How to Disable Push Create for Everyone But the Admin API

Resources