DevOps Classroom notes 21/Oct/2023

Building and Packaging Java Projects using a Maven

  • Compilation: Process of
    • checks for errors in code
    • converts to desired language (Byte code/machine code)
  • Packaging:
    • Combining compiled code into some packaging format
      • java: jar/war/ear
      • dotnet: dll/exe
  • Dependencies: will be downloaded
    • java: maven/gradle
    • dotnet: nuget
    • python: pip
    • nodejs: npm
  • Maven: combines dependency resolution, compilation, unit test executions, packaging
  • Maven expects a file called as pom.xml
  • Steps:
    • Get the latest code
    • Pre-requisites:
      • jdk version
      • maven
    • Execute mvn <goal>
      • compile
      • test
      • package
    • In our case we will be using mvn package

Setup a linux vm for building and packaging spring-petclinic

  • pre-req’s
    • git
    • maven
    • jdk 17
  • SSH into the vm & execute the following
sudo apt update
sudo apt install openjdk-17-jdk -y
sudo apt install maven -y
git --version
java -version
mvn --version

Preview
* Build steps

cd ~
git clone https://github.com/spring-projects/spring-petclinic.git
cd spring-petclinic
mvn package

Preview

Azure DevOps Pipelines

  • Azure DevOps has two ways of building pipelines

    • Classic Pipelines: We rely on user interface
      • Drawback:
        • History will be missing
      • Advantages:
        • Easy to start
    • Azure Pipelines YAML: Pipeline as Code. We will define pipelines steps in a file azure-pipelines.yaml and add it to the version control system (git)
      • Advantage:
        • History will be maintained
      • Disadvantage:
        • Learning curve for writing pipeline
  • Azure DevOps has agents: Agent is where the build is executed. There are two types of agents

    • Microsoft Hosted agents: These are machines which will be created on demand by Azure DevOps and will be delete upon build completion.
    • Self Hosted Agents: These are machines managed by us, we add these machines as agents to Azure DevOps.
  • Azure DevOps plans

    • Free:
      • 1 Free Microsoft-hosted CI/CD (1800 minutes/month)
      • 1 Free Self-Hosted CI/CD
      • Azure Source Repos => free
      • Azure Artifacts 2 GB

Configuring Spring petclinic build on Azure DevOps

  • Ensure you have some Azure DevOps Project
    Preview
  • Import the repository
    Preview
    Preview
    Preview
  • Lets setup build
    Preview
    Preview
    Preview
    Preview
    Preview
  • To solve this error we need to raise parallelism request Refer Here

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube