Building Java code for CI
- Goal:
- trigger: On pull request on main
- build the java code using maven
- run the unit tests
- package the application
- publish the test results report
- run static code analysis
- preserve the artifact
Azure DevOps Variables
- Lets understand Predefined variables: These are variables which are defined by azure devops
Preserving Artifact
- This can be done in two ways
- option 1: storing the artifact in azure devops linked to build
- option 2: using a formal artifact repository
- As we are still on PR’s lets use the option 1
- To publish artifacts we need to store it some where, To understand it better lets look at the concept of variables in Azure DevOps
- Artifacts in Azure Pipelines
Static code analysis
- We have to use external tools to perform static code analyis,
- The widely used static code analysis tools is sonar qube
- Sonar Qube has two versions
- free: This can be used for any public repository
- paid: This can be used for any repository
- Sonar Qube has two ways of deployment
- Self hosted
- Sonar Cloud:
- free:
- create an account with Github
- scanning for public repositories in main/master branch is free.
- free:
- Create a sonar cloud free account
Making Azure DevOps Projects Public
Handling external services with Azure DevOps
- Azure DevOps has a concept called as service connections using which it handle the connections to external services
- If you donot use service connections then steps of your pipeline or agent should have connection
- Azure DevOps Sonarqube integration
- Integrating with sonar to be continued
