Going from code to product in GitHub
In this tutorial, you will learn how to develop, (pre-)release, and optionally deploy any supported DataMiner artifact with a CI/CD pipeline in GitHub. These processes follow the same quality standards that developers within Skyline Communications adhere to.
If you are interested in learning how to set up CI/CD using different technologies, such as Jenkins, GitLab, Concourse, Azure DevOps, etc., take a look at the Setting up basic CI/CD for connectors tutorial.
This CI/CD pipeline will ensure strict quality standards, provide you with a private item registered in the DataMiner Catalog, and give you the ability to deploy the item automatically.
Expected duration: 10 minutes.
Private versus public code
Both SonarCloud and GitHub require paid licenses to fully support private GitHub repositories. For this tutorial, we recommend creating a public repository.
For real-world scenarios, you will likely need at least a paid SonarCloud license to work with private GitHub repositories. A free GitHub version can still be used for private repositories, but it will slightly change the tutorial below.
Prerequisites
- A GitHub and SonarCloud Organization set up as detailed under Setting up your development environment in GitHub (Skyline employees can use https://github.com/SkylineCommunicationsSandbox)
- Runtime .NET SDK 8.0 (download)
- A staging DataMiner Agent that is accessible from your pipeline and that uses DataMiner version 10.3.0/10.3.2 or higher
- Microsoft Visual Studio 2022
- Git
- A GitHub account
- DataMiner Integration Studio
Overview
- Step 1: Create a Visual Studio project
- Step 2: Create a GitHub repository
- Step 3: Add the Starter Workflow
- Step 4: Release a private item in the DataMiner Catalog
Step 1: Create a Visual Studio project
Open Visual Studio, and select Create a new project.
Select one of the available DataMiner templates from the list of templates (for example Ad Hoc Data Source Solution), and click Next.
Enter a solution name, for example SLC-GQIDS-MyDataSourceTest, and click Next.
We recommend adhering to Skyline's naming conventions, though this is not mandatory.
Follow the wizard for any additional information requirements.
Click Create.
Step 2: Create a GitHub repository
In the menu bar of Visual Studio, select GIT > Create GIT Repository.
Create a new GitHub repository:
Select a name, specify your GitHub account, and mark yourself as the owner.
When you have entered all the information, click Create and Push.
Go to the newly created GitHub repository on https://github.com/.
Tip
In Visual Studio 2022, you can open the GIT menu and select GitHub/View Pull Requests to quickly access the correct repository.
If your repository does not follow Skyline's naming conventions, specify the artifact type:
Go to the Code tab.
Click the cogwheel next to About.
Under Topics, add a topic with the artifact type, as defined under Inferring Catalog Item Type.
Tip
For more information, refer to the GitHubToCatalogYaml readme.
Step 3: Add the Starter Workflow
Go to the Starter Workflow:
For public repositories or paid GitHub subscriptions:
On your GitHub page, go to the Actions tab and select the DataMiner workflow that matches your solution type. If none of the names match, select DataMiner CICD AutomationScript.
For private repositories on a free GitHub subscription:
On your GitHub page, go to the Actions tab and select Set up workflow yourself.
Go to Skyline-Starter-Workflows and select the DataMiner workflow that matches your solution type.
If none of the names match, select DataMiner CICD AutomationScript.
Copy the content of the workflow file and paste it into your new workflow file.
Open a new browser window or tab, go to https://sonarcloud.io/projects/create, and create a project for the correct organization.
Enter the ID of the project as shown in the SonarCloud project URL as the
sonarCloudProjectName
.Open a new browser window or tab, and create and add the necessary GitHub secrets that you see in the workflow..
Go back to your pipeline file and click Commit Changes.
Commit the changes directly to the master branch.
Go to the Actions tab.
You should see your new workflow running. It will run for every Git push.
You should now see your CI jobs complete successfully, ensuring that quality standards are met.
Step 4: Release a private item in the DataMiner Catalog
On the Code tab for your repository on GitHub, on the right, click Create a new release.
Click Choose a tag and enter the version, for example
1.0.0.1-beta1
.You can use any version you want. For a pre-release, usually a suffix is added, which can contain any text, e.g. "-beta1" in the example above.
Enter a description of your release.
If this is a pre-release, select Set as a pre-release.
Click Publish release.
Go to the Actions tab.
You should now see your new workflow running in this tab. Your CI and CD jobs should complete successfully, ensuring quality standards are met and uploading the item to the Catalog UI as a private item.
Note
To be granted DevOps Points, take a screenshot of the successful run and send it to thunder@skyline.be.
Go to https://catalog.dataminer.services/, make sure your organization is selected in the top-right corner, and look up your artifact.
Note
If you see the following errors: Push .githubtocatalog/auto-generated-catalog Process completed with exit code 128. or remote: Permission to MyOrg/MyRepo.git denied to github-actionsbot, you will need to either set write permissions for the GITHUB_TOKEN in your specific repository, or, if you are an organization admin, you can enable this for the organization by setting the workflow permissions to Read and write permissions.