• Overview
    Key features
    • Observability
    • Auto-scaling
    • Multiframework
    • Security
    Frameworks
    • Django
    • Next.js
    • Drupal
    • WordPress
    • Symfony
    • Magento
    • See all frameworks
    Languages
    • PHP
    • Python
    • Node.js
    • Ruby
    • Java
    • Go
  • Industries
    • Consumer Goods
    • Media/Entertainment
    • Higher Education
    • Government
    • Ecommerce
  • Pricing
  • Featured articles
    • Switching to Platform.sh can help IT/DevOps organizations drive 219% ROI
    • Organizations, the ultimate way to manage your users and projects
  • Support
  • Docs
  • Login
  • Request a demo
  • Free Trial
Meet Upsun. The new, self-service, fully managed PaaS, powered by Platform.sh.Try it now
Blog
Thumbnail

GitLab Integration is here!

console
12 December, 2017
Ori Pekelman
Ori Pekelman
Chief Strategy Officer

As you might know, Platform.sh allows you to create, on-the-fly, an ephemeral staging/development environment, on the cloud, for every git branch or pull-request.

Basically, our main API is git. You create a branch push it. We take care of everything else. A whole functional cluster is born, with all of its dependencies. It gets its own URL you can visit in a browser. Test. Like it? Merge the pull-request. You just deployed.

You could use Platform.sh with nothing else.. The git server is included. But most teams require more from their git hosting service; They want a nice interface. They want pull (or merge) requests.

Now Platform.sh works with any git hosting service, and with our generic Webhook support it was always easy to work with Gitlab (and since the introduction of Gitlab-CI you could do some nifty stuff with it.). But as of late, more and more of you came clamoring for an easier integration. Something as simple and transparent as our Github and Bitbucket integrations.

Clamor no more.

platform integration:add --type gitlab --repository mygroup/example-repo --token {mytoken} --base-url https://gitlab.example.com

For us, it is exciting, as Gitlab is a tool we love here at Platform.sh; As a matter-of-fact, we moved our some 400 internal repositories from Github to it in the beginning of 2016 (on an internally managed enterprise version).

So how does the integration work, what does it do?

  • It creates a new environment when creating a branch or opening a pull request on GitLab.
  • It rebuilds the environment when pushing new code to GitLab.
  • It deletes the environment when merging a pull request.

Integrate, then fire and forget. And for the impatient, and detail-oriented amongst you  here is how you go about setting it up:

First, generate a token on your GitLab user profile. Go to your Settings page on GitLab and click Access Tokens. Fill the Name field, for example with "Platform.sh Integration" and ensure the token has the api read_user, and read_registry scopes. Copy the token.

Now, open a terminal window (you need to have the Platform.sh CLI installed). Enable the GitLab integration as follows:

platform integration:add --type=gitlab --token=THE-TOKEN-YOU-WROTE-DOWN --base-url=https://THE-URL-OF-YOUR-GITLAB/ --gitlab-project=MY-NAMESPACE/MY-PROJECTNAME

This should output the configuration of the integration. The last element would look like:

| hook_url | https://{region}.platform.sh/api/projects/{projectid}/integrations/{hook_id}/hook |

Now, copy the hook URL. Go to your GitLab repository and click Settings Integrations and paste the Payload URL, in the Triggers section choose Push events, Tag push events and Merge Request events. And click on Add webhook.

You can now start pushing code, creating new branches or opening merge requests directly on your GitLab repository. You will see environments get automatically created and updated on the Platform.sh side.

Get the latest Platform.sh news and resources
Subscribe

Related Content

Simple. Streamlined. Secure. Effortless user management has arrived with Teams

Simple. Streamlined. Secure. Effortless user management has arrived with Teams

Company
AboutSecurity and complianceTrust CenterCareersPressContact us
Thank you for subscribing!
  •  
Field required
Leader Winter 2023
System StatusPrivacyTerms of ServiceImpressumWCAG ComplianceAcceptable Use PolicyManage your cookie preferencesReport a security issue
© 2024 Platform.sh. All rights reserved.
Supported by Horizon 2020's SME Instrument - European Commission 🇪🇺