Information for: DEVELOPERS   PARTNERS   SUPPORT

Getting started with Code Studio

As you have reviewed the requirements and prerequisites, complete the following steps to get started with Code Studio:

What to know before you get started

Once your Code Studio entitlement is granted, you can self-enable your Code Studio subscription, users, and projects from the Cloud Platform user interface.

You must have a Code Studio project for your application hosted on Cloud Platform. This enables you to take advantage of the AutoDevOps CI/CD pipeline that Code Studio offers. This guide assumes that you are creating a Code Studio project from an existing application in Cloud Platform that contains a populated Drupal codebase.

Once you have completed the steps to create a project for your Cloud Platform application, you have an AutoDevOps pipeline in Code Studio that automatically:

  • Builds, tests, and deploys your Drupal application for each commit
  • Builds, tests, stages, and deploys your Drupal application for each merge request
  • Performs scheduled pipelines to automatically update your Composer packages and deprecated custom code

The AutoDevOps pipeline is managed by Acquia. However, you can customize certain settings in your Code Studio project with environment variables. For more information, see environment variables.

Viewing a Code Studio subscription

Once a Cloud subscription is enabled with Code Studio, subscription and entitlement details appear in the Manage section in the Cloud Platform user interface.

You can view the following elements of your Code Studio subscription in the Cloud Platform user interface:

  • Subscription type
  • Subscription duration
  • Total number of entitled Code Studio user seats
  • All assigned Code Studio user seats
  • Each Code Studio project associated with your Cloud Platform applications

To view the preceding information for your Code Studio subscription:

  1. Sign in to the Cloud Platform user interface.

  2. Click Manage.

  3. Select your organization with the Code Studio subscription.

  4. In the navigation pane, click Subscriptions.

  5. Click the Cloud subscription with the Code Studio entitlement.

    You can view your subscription entitlements including the available Code Studio seats.

    view-subscription-entitlements

    Note

    If 100% of your Code Studio seat entitlements are used and you need to purchase additional seats, contact your account manager.

  6. To view your Code Studio subscription in more detail, click Code Studio in the navigation pane.

    view-subscription

    You can view your subscription details, assign user seats, and create projects for Cloud Platform applications that belong to the associated Cloud subscription.

Assigning Code Studio user seats

After your subscription is enabled with Code Studio, you can assign user seats.

To assign Code Studio user seats:

  1. Sign in to the Cloud Platform user interface.

  2. Go to Manage and select your organization.

  3. Click Subscription and select the Code Studio subscription.

  4. View the number of seats that you can assign.

    view-code-studio-seats

  5. To assign a seat, click Assign Seat.

  6. Select a user and a role for the user. Code Studio is powered by GitLab and all user roles available in Code Studio are synonymous with GitLab user roles. For more information on GitLab permissions and roles, see Project members permissions.

    assign-seat-user

  7. Click Assign Seat.

    assign-seat

After you assign seats to your users, create a Code Studio project from Cloud Platform for a new or existing Acquia-hosted application.

For more information on managing and governing your Code Studio user seats, see Group, project, and user management.

Creating Code Studio projects from Cloud Platform

To create a Code Studio project, you can do one of the following:

  • Through the overview page of an application:

    create-code-studio-project

    return-to-application

  • Through the Code Studio management page (you can add multiple Code Studio projects through this user interface):

    applications-with-code-studio-projects

    create-projects-for-applications

    create-projects

Creating a Code Studio project

You can accomplish either of the following using the Setting up a Code Studio project instructions:

  1. Create and configure a new Code Studio project for your Cloud Platform application.
  2. (Re)configure an existing Code Studio project for your Cloud Platform application.

By completing these instructions, you have a Code Studio with an AutoDevOps pipeline that automatically:

  • Builds, tests, and deploys your Drupal application for each commit.
  • Builds, tests, stages, and deploys your Drupal application for each merge request.
  • Performs scheduled pipelines to automatically update your Composer packages and deprecated custom code.

Setting up a Code Studio project

  1. Create a Cloud IDE for your Cloud Platform application.

  2. Launch the Cloud IDE.

  3. If you already have a Drupal application code on Cloud Platform, select Configure IDE and Copy Code From Cloud Platform.

    To create a new Drupal application, run the acli new command and select acquia/drupal-recommended-project.

  4. To generate a personal access token, perform the following steps:

    1. Log in to Code Studio.

    2. In the top right corner, click your profile icon.

    3. Click Edit profile.

      The system displays your user settings.

    4. Click Access Tokens.

    5. In the Add a personal access token section, provide the required details to create a new personal access token for authenticating with Code Studio.

    6. In Name, enter a name for the token.

    7. In Selected Scopes, select the api and write_repository checkboxes.

    8. Click Create personal access token.

      Code Studio creates your new personal access token and displays it on the screen.

    9. Copy your new token.

    Important

    You must save your personal access token as you cannot access it again.

  5. Run the following command to authenticate with Code Studio:

    glab auth login --hostname=code.acquia.com
    
  6. Select HTTPS when prompted.

  7. Run the following commands to create and/or configure a Code Studio project for your Cloud Platform application:

    acli update
    acli cs:wizard --gitlab-host-name=code.acquia.com
    

    The ACLI command walks you through the following process:

    • (prompt) Creating an API token for Code Studio
    • (automated) Creating an SSH key for Code Studio
    • (automated) Setting GitLab CI/CD variables
    • (automated) Creating a scheduled pipeline for automatic updates
    • (automated) Pushing your Cloud Platform application code to Code Studio

Note

Cloud Platform sends an email to your user account notifying that an SSH key labeled CODESTUDIO_+key is added to your Acquia account. This is a normal, expected, and secure email that serves as a notification.

Pushing Drupal application code into your Code Studio project

Requirements:

Use one of the following options to continue the process of pushing Drupal application code into your Code Studio project:

Option 1: Use an existing Drupal Application repository

Requirements:

  • You must use a Drupal 8+ site.
  • You must use Composer to manage your application dependencies.
  • You must clone a copy of your Drupal code on your local machine or Cloud IDE.

To push an existing Drupal application repository into Code Studio:

  1. Navigate to your Drupal project directory on your local machine or in a Cloud IDE:

    cd <git repository path on your local machine or Cloud IDE>
    
  2. Push to Code Studio:

    git remote add codestudio http://code.acquia.com/[gitlab-group]/[gitlab-project-name].git
    
    git push codestudio <enter branch name>
    

Option 2: Generate a new Drupal application repository with Acquia CLI

To generate a new Drupal application repository:

  1. Run the acli new command and select acquia/drupal-recommended-project.
  2. Navigate to your new directory by running the cd <directory name> command.
  3. To use BLT, see the Using BLT section.
  4. Follow the directions to use an existing Drupal Application repository.