Curso SonarQube Boot Camp
16 horasVisão Geral
Curso SonarQube Boot Camp, Aprenda rapidamente como realizar análises estáticas poderosas que encontram bugs, vulnerabilidades e code smells neste treinamento intensivo de laboratório do SonarQube.
Seus negócios e carreira dependem de sua capacidade de produzir códigos seguros, confiáveis e sem erros rapidamente. Mas o código nunca é perfeito, mesmo que tenha sido revisado minuciosamente, respaldado por um conjunto completo de testes ou examinado minuciosamente por sua equipe de garantia de qualidade.
É aí que o SonarQube pode ajudar. O SonarQube é uma ferramenta de análise de código-fonte totalmente automatizada que pode se integrar aos seus processos de desenvolvimento existentes e colher imediatamente os benefícios de uma poderosa análise estática que encontra bugs, vulnerabilidades e code smells em cada compilação. Ele produz relatórios interativos para cada compilação e os armazena em projetos para que você possa acompanhar facilmente os problemas enquanto trabalha.
Este Curso SonarQube Boot Camp começa com como construir um servidor SonarQube. Em seguida, aborda como configurar a análise de código-fonte com um projeto de exemplo. Você aprenderá como analisar uma compilação e, em seguida, personalizar a análise para as necessidades do seu projeto. Por fim, você integrará a análise de código-fonte em um servidor de compilação Jenkins.
Objetivo
Após realizar este Curso SonarQube Boot Camp, você será capaz de:
- Execute a imagem do SonarQube Docker e faça um tour pela interface do usuário do SonarQube.
- Execute com banco de dados H2 incorporado e mapeie dados para partições externas.
- Execute com um banco de dados externo, como um contêiner PostgreSQL.
- Execute com docker-compose e use-o para mapear partições de dados e executar um contêiner de banco de dados.
- Crie um projeto SonarQube e obtenha uma chave para um scanner
- Execute uma varredura do Gradle.
- Corrija um problema em um projeto SonarQube e execute uma nova varredura.
- Altere ou adicione uma regra de verificação.
- Corrija uma compilação que falha em um portão de qualidade.
- Configure a integração do Jenkins.
- Instale o SonarLint em um editor como o IntelliJ e modifique algum código.
- Integre o SonarQube em um fluxo de trabalho CI.
Publico Alvo
- Administradores de segurança
- Qualquer equipe de segurança
- Administradores do sistema
- Praticantes de DevOps
- Equipe de operações de TI
- Engenheiros de lançamento
- Gerenciadores de configuração
- Qualquer pessoa envolvida com infraestrutura de TI
- Desenvolvedores e líderes da equipe de aplicativos
- Scrum Masters
- Gerentes de software e líderes de equipe
Materiais
Português/Inglês + Exercícios + Lab PraticoConteúdo Programatico
Introduction to SonarQube
- What is SonarQube?
- Overview of SonarQube's Different Editions, Licenses, and Costs
- Exercise: Run the SonarQube Docker image and take a tour of the SonarQube UI.
- The Docker image will run in demo mode.
- Log in with the default user.
- Change the admin password on the next screen.
- Visit the top-level menu areas:
- Projects: SonarQube will create projects as required, or they can be created via the administration area.
- Issues: This is where deficiencies in code are tracked.
- Rules: Rules are configurable to for code scans.
- Quality Profiles/Quality Gates: These are configurable sets of rules for evaluating projects.
- Administration: This is where you can configure SonarQube.
Installation and Basic Administration
- How to Install and Run SonarQube From Docker
- Run with embedded H2 database, and map data to external partitions.
- Run with an external database, such as a PostgreSQL Container.
- Run with docker-compose and use it to map data partitions and run a database container.
- Exercise: Install SonarQube with docker-compose with a PostgreSQL container.
- Administer SonarQube
- General settings
- SMTP host/port
- SSL
- Base URL
- Add users and groups
- Overview of permissions and permissions templates
- General settings
- Plugins
- Installing a plugin from the marketplace
- Installing a plugin from a file
- Exercise: Install a plugin.
Analyzing Code
- Overview of Analyzing Code With SonarQube
- How analysis is performed:
- Scanner requests data from the server
- Scanner examines files
- Results are uploaded to the server
- Server stores analysis in a project; if required, a new project is created
- Review different scanners and how they are configured and used
- Gradle
- .NET
- Maven
- Jenkins
- Azure
- Ant
- CLI
- Discuss the limitations of the community edition versus the developer edition
- Analyze branches in developer edition
- Analyze pull requests in developer edition
- How analysis is performed:
- Create a SonarQube Project and Get a Key for a Scanner
- Add a project, or allow SonarQube to create one
- Add users
- Restrict user to specific projects
- Set analysis scope
- Adjust file patterns so SonarQube analyzes only the file you want
- Adjust directory patterns
- Specify files to be ignored
- How to generate a token for a scanner
- Exercise: Create a project.
- Add an unprivileged user.
- Create a project.
- Associate new user with the new project.
- Log in as the new user and generate a scanner token.
- Exercise: Perform a scan from Gradle.
- Fork sample projects from SonarQube's GitHub.
- Check out the project and configure Gradle for the SonarQube server and the token from the previous exercise.
- Run a scan and view results.
- Introduce new code with errors into the project.
- Run a scan and view new results.
- View Report Results
- Report overview page
- New code/overall code tabs
- Bugs, vulnerabilities, security hot spots, and technical debt
- Drill down into issue details
- View issue descriptions
- View issues in-line with code
- Exercise: Fix an issue from the previous project and run a new scan.
- Report overview page
- SonarQube Scanning Rules
- View rules for different languages
- Exercise: Alter or add a scanning rule.
- Alter or add a scanning rule that will trigger an error in the project.
- Rerun the analysis and view the issue.
- Fix the issue, and run a new scan.
- SonarQube Quality Profiles and Quality Gates
- View quality profiles
- View quality gates
- Exercise: Fix a build that fails a quality gate.
- Introduce a bug that will fail a quality gate.
- Run scan and view results.
- Reverse big and run a new scan.
CI Integration
- Overview of Jenkins and Jenkins Integration With SonarQube
- Exercise: Set up Jenkins integration.
- Run Jenkins Docker container.
- Perform basic Jenkins configuration.
- Users
- Git repo
- Install and configure the SonarQube plugin.
- Set up a Jenkins job using the SonarQube plugin.
- Run an analysis.
- Exercise: Set up Jenkins integration.
SonarLint
- Overview
- Exercise: Install SonarLint in an editor such as IntelliJ and modify some code.
Putting It All Together
- Overview of SonarQube CI workflow: Code, Commit, Build, Analyze
- Exercise: Integrate SonarQube into a CI workflow.
- Set up automatic build with analysis.
- Add code that will trigger a warning.
- Commit and push.
- Review report.
- Fix error.
- Commit and push.
- Review report.
- Repeat as needed.
- Exercise: Integrate SonarQube into a CI workflow.