Azure DevOps
Learn how to integrate Debricked with Azure DevOps.
Last updated
Was this helpful?
Learn how to integrate Debricked with Azure DevOps.
Last updated
Was this helpful?
With our CI integration to Azure DevOps you can automatically upload your latest commits and pull requests to Debricked or whenever you run your pipeline. Our Azure DevOps integration support the same options as our Bitbucket integration.
Start by generating an access token. Copy the token so that you can use it in the next step.
Configure your DEBRICKED_TOKEN variable by going to [your repository] -> Pipelines -> [your pipeline name] -> Edit -> Variables. Make sure to check “Keep this value secret” so that you do not expose your login credentials to the world.
Depending on what package manager you are using there are different step setups.
In order to analyze all dependencies in your project, their versions, and relations, files containing the resolved dependency trees have to be created prior to scanning. Those depend on the package manager used. Debricked tries to generate the lacking files, which can negatively affect speed and accuracy.
Example 1: If npm is used in your project you will have a package.json file, but in order to scan all your dependencies, Debricked requires either package-lock.json or yarn.lock as well.
Example 2: If Maven is used in your project, you will have a "pom.xml" file, but in order to resolve all your dependencies, Debricked requires a second file, as Maven does not offer a lock file system. Instead, "Maven dependency:tree" plugin can be used to create a file called ".debricked-maven-dependencies.tgf".
Add the template to your "azure-pipelines.yml" file (if the file does not exist, create one)
Commit your changes to "azure-pipelines.yml" and watch the CI run.
Integrating many repositories with one configuration using Azure DevOps can greatly simplify the process of managing and deploying code across multiple projects.
To avoid having to add the DEBRICKED_TOKEN
to every integrated repository, it is possible to share the Debricked token between repositories. In order to enable this, you should create a variable group:
Sign into your organization and select your project.
Go to Pipelines → Library → Variable groups.
Click + Variable group.
Enter a suitable name for your variable group, for example, "Debricked”.
Click + Add.
Add your token to a secret variable called DEBRICKED_TOKEN
(to make it secret, toggle the "lock" icon at the end of the row).
Click Save.
Go to the Pipeline permissions tab.
Click the three vertical dots and choose Open access to allow access in all pipelines. If you want to, it is also possible to just specify specific pipelines who should get access. After this, you can use the created variable in your repository pipelines.
If you would like to use our shared template out-of-the box without modifications, you should first create a service connection to GitHub. If you are, however, planning on copying the main template into your own organization you can skip this step.
Go to Project settings → Service connections.
Click Create service connection.
Select Github from the list and click Next.
Under OAuth Configuration drop-down, select AzurePipelines.
Click Authorize and follow instructions, using your own GitHub account.
Give new service connection name, which you will use as a value for endpoint parameter later on
Click Save.
You can now use the following template in pipelines of repositories you want to integrate with Debricked. The triggering template refers directly to the Azure DevOps template core repository found in the Debricked CLI repository. If you want to make modifications to it, it is also possible to copy the template from the CLI repository into a core repository of your own, which you would then refer to in the triggering template below.
NOTE: During the first run of the pipeline, you will be asked permission to run the subsequent jobs. You should click Permit.
By directly referencing the Debricked core repository, you will automatically receive any new updates made to the Debricked core repository template. If you want to customize the template, use the setup described in option 2 below.
In the repositories that you want to trigger the shared pipeline from, paste the triggering template above to an azure pipelines yaml file.
Fill in the variables to match the Debricked core repository according to the list below. If youare not using the variable group from step 1, remove the variables section from the triggering template:
<variable_group_name> - The name of the variable group created in step 1.
<repository_reference> - The named reference of your choice.
<repository_type> - github
<username_or_project> - debricked
<repository_name> - cli
<service_connection_name> - The name of the service connection created in step 2.
<resource_template_file_name> - examples/templates/Azure/azure-pipelines.yml
By using your own core repository containing the template in Azure DevOps, you do not need to create a service connection and can customise the template to your liking.
Create a new repository in your organisation or use an already existing one as the core.
Paste the Debricked template contents from the Debricked template into an "azure pipelines yaml" file:
If you want to set up scanning in this repository as well and want to use the variable group from step 1, add the variables section from the triggering template above into the template under the “debricked_scan” job.
In the repositories that you want to trigger the shared pipeline from, paste the triggering template above to an "azure pipelines yaml" file. If you are not using a service connection, you should remove the endpoint variable from the triggering template.
Fill in the variables to match the chosen core repository according to the list below. If you are not using the variable group from step 1, remove the variables section from the triggering template:
<variable_group_name> - The name of the variable group created in step 1.
<repository_reference> - The named reference of your choice.
<repository_type> - git
<username_or_project> - The name of the azure project containing your core repository.
<repository_name> - The name of the core repository.
<service_connection_name> - This variable is not needed if the core repository exists in your organisation. Remove the endpoint variable.
<resource_template_file_name> - The path or name to the template file in your core repository.
Debricked can generate pull requests for you, but to be able to use it in Azure DevOps, you should provide the credentials so that the pull request can be created on your Azure DevOps instance.
You can generate a Personal access token by going to the User settings -> Personal access tokens. You should:
Select your organization (or you can create a token for all accessible organizations).
Set custom expiration date to the maximum possible value.
Grant the token the code (read, write and manage) scope. When you try to create a Pull Request inside the Debricked tool, it will automatically ask you for your credentials when needed.
Fill out the form:
Host: enter the domain, e.g.: "https://dev.azure.com/", "https://azure.yourcompany.com", "https://org.visualstudio.com"
Token: enter the personal access token created before and enter
After clicking Confirm, the merge request generation will start.