This is the sixty-first article of Jerry in 2021, and the 338th official account of the Wang Zixi public number.
Short song line
Sing when drinking, life is geometric!
For example, the morning dew is much more bitter.
Be generous and unforgettable.
How to relieve worries? Only Du Kang.
Qingqingzijin, leisurely my heart.
But for your sake, I ponder so far.
Yo yo, deer crow, eat wild apples.
I have a guest who plays the drum, the harp and the Sheng.
As bright as the moon, when can I do it?
Sorrow comes from it and cannot be cut off.
Cross the paths and cross the paths in vain.
Qikuo talks about the past and remembers the old kindness.
The moon is bright and the stars are rare. Black magpies fly south.
Three turns around the tree, what branch can we rely on?
The mountains are never tired of being high and the sea is never tired of being deep.
Zhou Gong spits and feeds, and the world returns to its heart.
Jerry wrote an article before,Use abapgit to transfer code between ABAP on premises system and SAP cloud platform ABAP environment, this paper introduces the basic usage of abapgit, an open source tool.
In this article, Jerry introduces a specific scenario of realizing ABAP continuous integration based on abapgit and another open source tool, abaplint: when new code is submitted to the ABAP code warehouse, ABAP code detection is automatically triggered.
Of course, continuous integration means that as long as new code is submitted, the build and test will be run automatically and the running results will be fed back. Only when you can ensure that the newly submitted code meets the expectations, can you integrate the new code into the trunk. Therefore, the example introduced in this article is only a small step in ABAP continuous integration.
Jerry uses angular to develop SAP commerce cloud UI every day, and also uses the extension of visual studio code named tslint to detect typescript code.
Similarly, abaplint is also an open source tool for detecting ABAP code according to specified rules, which is written based on typescript.
Here is a demo website:
Abaplint.json is a configuration file that defines detection rules. The code violating the rules will be highlighted by a red wavy line:
I adjusted the code according to the prompts detected by abaplint, and then the warning messages disappeared.
Note that abaplint’s detection of the code is completely different from the syntax check of the code on the ABAP server. The latter is completed by the compiler located in the ABAP kernel, while the former is only the detection based on the source code text level implemented by typescript. Abaplint itself cannot recognize the ABAP language from the syntax level, but mechanically completes the detection task defined in abaplint.json based on text static analysis.
The following describes how to configure abapgit and abaplint to achieve the simplest ABAP continuous integration. This example does not require any development, only contains some configuration work, which can be completed in less than half an hour.
(1) Create a GitHub repository to store ABAP code. I chose to put all the ABAP code in the SRC folder.
Note: abaplint can only scan ABAP code files in special format, that is, ABAP code submitted through abapgit.
Create a new. GitHub folder with a subfolder workflow, which contains an abaplint.yml file.
This abaplint.yml file is responsible for specifying the operation content to be performed through GitHub workflow when new code is submitted in the code warehouse. The on instruction starting from line 2 tells GitHub to execute a job named abaplint when a push or pull request arrives in the main branch. The specific steps of the latter are defined from the steps instruction on line 14.
The uses instruction in line 15 means to reuse GitHub’s own setup node action to complete the preparation of the node.js running environment.
The setup node action is implemented in the GitHub repository as follows:
The following command line maintained in the run command means that after the node.js running environment is ready, install the abaplint command line tool and execute it.
npm -g install @abaplint/cli
(2) Create abaplint.json under the root directory and define ABAP code detection rules. For demonstration purposes, I only enabled a few simple rules as shown in the figure below. For all detection rules supported by abaplint.json, please refer to this link:
After creating the abaplint.yml and abaplint.json files, submit any code to the main branch, and you can see the automatic abaplint detection records for these code submissions in the actions tab of the code warehouse:
Click one to see the reason for the current workflow execution failure – the code violates my customized abaplint detection rule: the defined keyword needs to be lowercase, and the keyword add marked as obsolete is used, etc.
At present, automated tools for continuous integration construction and testing emerge in an endless stream in the open source community. The sap commerce cloud Spartacus UI development team worked by Jerry uses Travis
Travis supports binding GitHub’s code warehouse. As long as new code is submitted, it will be automatically fetched. Then provide a running environment, execute the test and complete the build.
In order to enable Travis to capture the code submitted by my ABAP code warehouse, I created a. Travis.yml file in the project root directory. The content is shown in the following figure. The command line in the script area is exactly the same as that in abaplint.yml described above. I won’t repeat it here.
After editing the. Travis.yml file, resubmit it, log in to the Travis console, and find that this submission triggers a new Travis build:
The reason for the build failure is that it violates the rules defined by abaplint.json:
Honestly, according to the results output by abaplint, repair and resubmit all violations of the rules in the ABAP code. This time, the GitHub workflow and the build log in Travis finally show a green light.
The ABAP code warehouse address used for this demonstration is as follows:
Through a specific example, this paper introduces how to use abapgit, abaplint and Travis to realize the steps of automatic code detection based on new code submission in ABAP continuous integration scenario.
In the actual SAP product development project, the scenario complexity of continuous integration is much greater than this example, so it is usually completed by a specially assigned person or even a special team.
Thanks for reading.
More Jerry’s original articles are: “Wang Zixi”:
Jerry’s ABAP topic
- What should ABAP developers learn in the future
- Jerry’s May Day holiday in 2017:ABAP implementation of eight classical sorting algorithms
- Jerry’s collection of ABAP original technical articles
- 300 lines of ABAP code implement the simplest blockchain prototype
- Use java + SAP cloud platform + SAP cloud connector to call functions in ABAP on premise system
- Consume ABAP on premise OData service in the cloudfoundry environment of SAP cloud platform
- ABAP vs Java, breaststroke vs freestyle
- Talk about C language and ABAP
- Use ABAP channel to develop some small tools to improve daily work efficiency
- The boring things I’ve done with ABAP
- Don’t like SAP GUI?Try eclipse for ABAP development
- Writing and activating ABAP code using Visual Studio code
- Did your ABAP program give light to the Buddha?Let’s try Jerry’s trick
- Write the first ABAP program on the ABAP programming environment of SAP cloud platform
- ABAP programming specification officially issued by SAP
- Do you know the hidden functions of ABAP code inspector?
- Are you still using ABAP for secondary development of SAP products? Let’s learn about this new concept of secondary development
- Those parasitic programming languages in ABAP NetWeaver
- Start with a blog on the sap community and talk about the feelings behind the naming of SAP products
- ABAP restful service development in the cloud
- How to expose CDs view as OData service in ABAP programming environment of SAP cloud platform
- Use abapgit to transfer code between ABAP on premises system and SAP cloud platform ABAP environment
- 30 minutes to develop a Fiori application supporting addition, deletion, modification and query with restful ABAP programming model
- Jerry takes you through the second in the restful ABAP programming model series: the implementation of action and validation
- Jerry takes you through restful ABAP programming model series 3:Cloud ABAP application debugging
- How to consume third-party services in ABAP programming environment on SAP cloud platform
- It’s time for ABAP developers to go to the cloud – now you can use the trial version of SAP cloud platform ABAP environment for free
- Learning without thinking is useless – the origin and application scenario of ABAP programming environment for SAP cloud platform
- Trident application in SAP cloud platform
- How to develop and deploy a Fiori application that supports addition, deletion, modification and query based on restful ABAP programming model
- Interpretation of SAP 2019 teched key note: how do SAP employees do secondary development in the cloud era?
- What ABAP keywords and syntax can’t be used in the ABAP cloud environment?
- ABAP development environment finally supports automatic formatting of ABAP variable names with hump naming method
- Use the new keyword reduce of ABAP 740 to complete a practical task
- A shivering ABAP code
- Yesterday Halloween ABAP monster level code mystery, announced the answer
- This paper introduces a method of efficient internal table copy in ABAP kernel state
- A practical example of developing OData using SAP cloud application programming model
- When ABAP meets Prometheus
- Draw scalable vector diagram using ABAP
- The things highlighted by ABAP development environment syntax
- Seven weapons for SAP error message debugging:So that all error messages can be located
- Several methods of using ABAP to operate Excel
- Favorite transaction code management tool in SAP GUI
- SAP GUI and windows registry
- Can you do bad things with debug permission? Be careful, your every move is monitored by the system
- What are ABAP, ccdef, ccimp, ccmac, ccau, cmxxx
- Three ways to implement ABAP conditional breakpoints
- Use sat tracking to monitor the performance and call stack of SAP applications opened from the browser
- A 13 year ABAP veteran’s suggestion: understanding these basic knowledge is beneficial to ABAP development
- SAP ABAP NetWeaver containerization, impossible tasks?
- SAP product enhancement technology review
- Complete collection of SAP API development methods
- Talking about the static agent and dynamic agent of Java and SAP ABAP, and the attempt of ABAP aspect oriented programming
- HTTP response status code of SAP ABAP application server
- Is there a collection tool class like Java list in SAP ABAP? CL_ OBJECT_ Collection, find out
- ABAP interview question series: write a group of ABAP programs that will deadlock
- Explanation of standard login mode of SAP ABAP NetWeaver server
- SAP ABAP keyword syntax diagram and ABAP code automatic generation tool Code Composer
- Alternative use of SAP ABAP SM50 – ABAP work process detection of database table reading operations
- A knowledge point about the number of characters of SAP ABAP character variable and string variable, and a murder case
- Usage analysis of a group of keywords is bound, is not initial and is assigned in SAP ABAP
- Weak reference and soft reference in SAP ABAP and Java
- Introduction to sap AMDP – Hana database process hosted by ABAP
- Tag your ABAP object
- Today in history: billion dollar error in null references in programming languages
- Summary of ABAP development tool code template and other practical skills
- Ten tips for SAP ABAP development tool to improve development efficiency
- How to consume soap based web services in ABAP programming environment of SAP BTP platform
- Will ABAP really become obsolete? Talk about ABAP’s past, present and future