


Let's talk about how to use Angular+Jenkins to display build versions
This article will take you to continue learning angular and learn how to use Jenkins combined with Angular to display the built version. I hope it will be helpful to everyone!
In Angular combined with Git Commit version processing At the end of the article, we are left with questions?️ Let’s concrete the problem
Combined with the Jenkins build, we can get the build information, such as the build number, and can it be backfilled to the page? [Related tutorial recommendations: "angular tutorial"]
is as follows:
Uha, we will modify it based on the original .
Add file build_info.json
to the root directory.
{ }
You read that right, the content of
build_info.json
is{}
##build_info.json The file is generated when
Jenkinsfile is built.
- Execute
Jenkinsfile
during the build process to generate
build_info.jsonfile
- When packaging the project, consider whether to obtain the contents of the
build_info.json
file for different environments
For the convenience of demonstration, the environment here only considers the production environment.The above steps are two simple steps. The most important point is
How to write the contents of the build_info.json file
.
Jenkinsfile related content, please read it in conjunction with the
Jenkins Pipeline and Gitlab to implement automatic construction of Node projects article. At this time, your focus is on the content of the article Jenkinsfile, as follows:
pipeline { agent any tools { nodejs "nodejs" } stages { stage('Dependency') { steps { sh 'npm install' } } # 我们在此添加过一个 stage,见下面? stage('Build') { steps { sh 'npm run clean' sh 'npm run build' } } } }
stage to complete our
build_info.jsonWriting of files.
stage('Version') { steps { script { def amap = 'build_number': BUILD_NUMBER, # 构建号 'job_name': JOB_NAME # 任务名称 ] # 写入文件 writeJSON file: WORKSPACE+'build_info.json', json: amap # WORKSPACE 根目录 } } }
build_info.json, I intercept the
version. js The content of the production environment:
// 引入生成的 build_info.json 文件 let buildInfo = require('./build_info.json'); if(config.env === 'production') { // 获取构建的版本号,否则获取默认的版本 versionObj.version = buildInfo.build_number || config.version }
angular, it is just used to cooperate with
jenkins. The next article is about using
Angular for
spa development, so stay tuned.
This article is reproduced from: https://juejin.cn/post/7081642981890981895Author: JimmyFor more programming-related knowledge, please visit :
Programming Video! !
The above is the detailed content of Let's talk about how to use Angular+Jenkins to display build versions. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to use JenkinsPipeline to build a continuous packaging and deployment process for PHP programs? Jenkins is a very popular continuous integration and deployment tool. It provides a wealth of plug-ins and functions to make the build and deployment process simple and efficient. JenkinsPipeline is the latest plug-in for Jenkins, which allows us to use a complete and extensible DSL (DomainSpecificLanguage) to define continuous integration and deployment.

Angular.js is a freely accessible JavaScript platform for creating dynamic applications. It allows you to express various aspects of your application quickly and clearly by extending the syntax of HTML as a template language. Angular.js provides a range of tools to help you write, update and test your code. Additionally, it provides many features such as routing and form management. This guide will discuss how to install Angular on Ubuntu24. First, you need to install Node.js. Node.js is a JavaScript running environment based on the ChromeV8 engine that allows you to run JavaScript code on the server side. To be in Ub

How to use monaco-editor in angular? The following article records the use of monaco-editor in angular that was used in a recent business. I hope it will be helpful to everyone!

Do you know Angular Universal? It can help the website provide better SEO support!

With the rapid development of the Internet, front-end development technology is also constantly improving and iterating. PHP and Angular are two technologies widely used in front-end development. PHP is a server-side scripting language that can handle tasks such as processing forms, generating dynamic pages, and managing access permissions. Angular is a JavaScript framework that can be used to develop single-page applications and build componentized web applications. This article will introduce how to use PHP and Angular for front-end development, and how to combine them

This article will take you through the independent components in Angular, how to create an independent component in Angular, and how to import existing modules into the independent component. I hope it will be helpful to you!

The default display behavior for components in the Angular framework is not for block-level elements. This design choice promotes encapsulation of component styles and encourages developers to consciously define how each component is displayed. By explicitly setting the CSS property display, the display of Angular components can be fully controlled to achieve the desired layout and responsiveness.

The Angular project is too large, how to split it reasonably? The following article will introduce to you how to reasonably split Angular projects. I hope it will be helpful to you!
