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

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

Related

Change role names in gitlab from master to maintainer

In some of our projects, we are moving away from 'master' branch to 'main' branch. I noticed in our project, we have a role called 'master', and I wanted to know how/if I can change it.
I see in the gitlab documentation that they no longer have a role called 'master', but it looks like it's equivalent is 'maintainer'. However, from within our gitlab organization help pages (from clicking 'Help' under my avatar at the top left), the role is referred to as 'Master'.
Can I change the role within our project? Or does that have to be done at the organization level?
Permissions and roles are statically defined in GitLab, as illustrated for instance by commit a63bce1, which did rename the Master role to Maintainer.
So unless you are modifying the sources from GitLab itself, or upgrading your on-premise GitLab to 13.x (since the change came during the 12.x releases serie), you would still see master instead of maintainer.

How do I use Octokit to turn on Github Pages for a repo?

I have a Ruby program that makes a new repo for a user using Octokit. I would also like to enable Github Pages for the repo from my program, but I can't figure out if that is possible. The Pages API seems to assume pages are already enabled.
There is no specific API to call when "enabling" the GitHub page feature.
As described in "Configuring a publishing source for GitHub Pages"
If your site is a User or Organization Page that has a repository named <username>.github.io or <orgname>.github.io, you cannot publish your site's source files from different locations.
User and Organization Pages that have this type of repository name are only published from the master branch.
For other project repos, the following settings needs to be set manually first:

How to setup authoring env to publish site to remote git repo?

I downloaded and started authoring environment (crafter-cms-authoring.zip)
Created site backed by remote git repo as described in: Create site based on a blueprint then push to remote bare git repository
Created a content type, new page.
Published everything
Now, I would expect, that I can see my changes in the remote repo. But all I can see are the initial commits from the 2. step above. No new content type, no new page, no branch "live". (The content items are however visible in the local repo)
What is missing?
Edit:
Since Creafter can by set up in many ways, in order to clarify my deployment scenario, I am adding deployment diagram + short description.
There are 3 hosts - one for each environment + shared git repo.
Authoring
This is where studio is located and content authors make changes. Each change is saved to the sandbox local git repository. When a content is published, the changes are pulled to the published local git repository. These two local repos are not accessible from other hosts.
Delivery
This is what provides published content to the end user/application.
Deployer is responsible for getting new publications to the delivery instance. It does so by polling (periodically pulling from) specific git repository. When it pulls new changes, it updates the local git repository site, and Solr indexes.
Gitlab
This hosts git repository site. It is accessible from both - Authoring and Delivery hosts. After its creation, the new site is pushed to this repo. The repo is also polled for new changes by Deployers of Delivery instances.
In order for this setup to work, the published changes must somehow end up in Gitlab's site repo, but they do not (the red communication path from Authoring Deployer to the Gitlab's site)
Solution based on #summerz answer
I implemented GitPushProcessor and configured new deployment target in authoring Deployer, adding mysite-live.yaml to /opt/crafter-cms-authoring/data/deployer/target/:
target:
env: live
siteName: codelists
engineUrl: http://localhost:9080
localRepoPath: /opt/crafter-cms-authoring/data/repos/sites/mysite/published
deployment:
pipeline:
- processorName: gitPushProcessor
remoteRepo:
url: ssh://path/to/gitlab/site/mysite
I think you might have confused push with publish.
On Publishing
Authoring (Studio) publishes to Delivery (Engine) after an approval workflow that makes content go live. Authoring is where content (and code if you like) is managed and previewed safely, then that is published to the live delivery nodes for delivery to the end-user.
On DevOps
A site's local git repository can be pushed/pulled to/from remote repositories. This means:
Code can flow from a developer's workstation to Studio (via a github, gitlab, bitbucket etc.) <== this is code moving forward (and can flow via environments like QA, Load Testing, etc.)
Content can flow back, from Studio to the developer's local workstation in a similar manner <== this is content moving backward (you can have production content on your laptop if you want)
When code flows forward from a developer to Studio, that's when Studio pulls from the remote git repo.
When content flows backward from Studio to the developer, that's when Studio pushes to the remote git repo.
Documentation
A good bird's eye view of the architecture of the system relating to publishing can be found here: http://docs.craftercms.org/en/3.0/developers/architecture.html
A good article that explains the DevOps workflow/Git stuff is here: http://docs.craftercms.org/en/3.0/developers/developer-workflow.html
Update based on the expanded question
My new understanding based on your question is: You can't allow the deployers in Delivery to access Authoring's published repo to poll due to some constraint (even over SSH and even with limits on the source IP). You'd like to use GitLab as a form of content depot that's accessible as a push from Authoring and pull from Delivery.
If my understanding is correct, I can think of two immediate solutions.
Set up a cron job in authoring to push to GitLab periodically.
You'll need to add GitLab as a remote repo in published and then set up a cron like this:
* * * * * git --git-dir /opt/crafter/data/repos/sites/{YOUR_SITE}/published/.git push 2>&1
Test it out by hand first, then cron it.
Write a deployer processor that can push content out to an end-point upon a change or, wait for the ticket: https://github.com/craftercms/craftercms/issues/2017.
Once this is built, you'll need to configure another deployer in Authoring that will push to GitLab.
In either case, beware not to update things in GitLab since you're using published and not sandbox. (See DevOps notes above to learn why.)

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

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.

gitlab giving users code download rights but no rights to see project

Is there a way in gitlab to disable a project from showing up as a project if the user only has guest level privileges?
To clarify and add a little more detail.
I have added the ability for guest to download code but removed pretty much every privellege regarding actually using gitlab to look at the project. Which means that if the project shows up as a project to the user and they click on it gitlab returns an error. I would much rather gitlab not show the project at if the user has guest level access.
We use git submodules in our projects and we need to be able to give people the ability to clone a repo and all it submodules without giving everyone access to browse and find every project that can be a submodule or making projects public.
Currently not. But feel fee to create a PR which add's this functionality

Resources