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
- Assign the work-item you previously created to yourself.
- Note down the work-item number, this will be needed later.
- Open the Azure DevOps Pipeline Create API Repo (OAS Based).
- Select
Run pipeline
in the upper right corner. - Update parameters
- 1 Make sure that
main
is selected underBranch/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
valuestandard
as is. If you know you will have browser based clients with cors support you can usestandard-cors
instead. More info
- 1 Make sure that
-
Click
Run
-
Wait until the pipeline is done.
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.
-
Go to the pipeline run that is waiting for permission and select
View
-
Click on
Permit
in the Waiting for review dialog
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.
- Go to Project Settings and then Service connections
- Click on one of the service connections and then select Security under the three-dot menu (More actions)
- Click the plus sign on the Pipeline permissions panel and select the API deployment pipeline.
- Repeat for the other service connections.
Step 3 - Clone repository
-
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. -
Select
Clone
(in the upper right corner) to clone it to your local machine.- If you are using
VS Code
or any other IDE, select your IDE of choice and follow the instructions.
- If you are using
-
Go to your local version of the repository
-
Change (checkout) branch to
feature/[workitem]-add-configuration
, ex: feature/123456-add-configuration.
git checkout feature/123456-add-configuration