Skip to content

Create repository

Self hosted repository configuration (Only self-hosted repos)

If you have your own DevOps project (within the LKAB organization), and prefer to host your API repository yourself, there are some prerequisities to set before continuing on this guide.

Walk through the Self hosted repository prerequisities guide and come back here to complete the the repository creation steps below, using your own DevOps project name below.

Step 1 - Prepare and run the Create API Repo pipeline

  1. Assign the work-item you previously created to yourself. Assign the work-item to yourself
  2. Note down the work-item number, this will be needed later.
  3. Open the Azure DevOps Pipeline Create API Repo (OAS Based).
  4. Select Run pipeline in the upper right corner.
  5. Update parameters
    • 1 Make sure that main is selected under Branch/tag
    • 2 Set the feature branch name, follow the pattern feature/[workitem]-add-configuration. Replace the [workitem] with the work item number of the work-item created earlier, ex: feature/123456-add-configuration
    • 3 Set the name to use for the repository, use the API Id from the API Catalog in lowercase as name, Pattern [api[0-9]{4}-[a-z0-9-], Ex. api9999-lkab-test
    • 4 Set the readable name of the API (suggest using the same name as in OpenAPI Specification), ex. LKAB.Test.API. (NOTE: No special characters except for -_.)
    • 5 Optional. If you host your API repository in your own DevOps project, enter the name of the DevOps project, e.g. IP21, otherwise leave the default $(System.TeamProject)
    • 6 Optional. For a standard backend with a azure ad token. Leave the default value standard as is. If you know you will have browser based clients with cors support you can use standard-cors instead. More info
      Run pip
  6. Click Run

  7. Wait until the pipeline is done.

Run pip

Step 2 - Repository pipeline permissions

The Create API Repo (OAS) pipeline creates an API deployment pipeline and a GIT repository in the target DevOps project.
The first time the API deployment pipeline is executed it needs permission to use the service connection apimgmt-dev.

To be able to permit you need to be a member of group Endpoint Administrators or Project Administrators in the DevOps project (see Project Settings > Permissions) or to have permissions in the LKAB DevOps organization.
Need help? Send an email to the api management team.

  1. Go to the pipeline run that is waiting for permission and select View Review APIM Service connection

  2. Click on Permit in the Waiting for review dialog Permit APIM Service connection

The same procedure is needed when the pipeline is building for the other environments test, stage and prod but then you are permitting service connections apimgmt-test, apimgmt-stage and apimgmt-prod instead.

It is also possible to permit the pipeline to use the service connections beforehand.

  1. Go to Project Settings and then Service connections
  2. Click on one of the service connections and then select Security under the three-dot menu (More actions)
  3. Click the plus sign on the Pipeline permissions panel and select the API deployment pipeline. Add Service connection permission
  4. Repeat for the other service connections.

Step 3 - Clone repository

  1. Go to Repos in your DevOps project and select the newly created repo, ex. api9999-lkab-test.
    Note! If you did not create the API repo in your own DevOps project, the API repo is found in the api-management-apis project. repo select

  2. Select Clone (in the upper right corner) to clone it to your local machine.

    1. If you are using VS Code or any other IDE, select your IDE of choice and follow the instructions. Clone repository
  3. Go to your local version of the repository

  4. Change (checkout) branch to feature/[workitem]-add-configuration, ex: feature/123456-add-configuration.
    git checkout feature/123456-add-configuration