Continuous integration deployment - the difference between single and double quotes in Jenkinsfile


Here I record the two problems I encountered, and during the subsequent analysis process, I will gradually compare the differences between single and double quotation marks.

1. Problem 1: Unable to pass dynamic variables into the command

When writing a Jenkinsfile, we may define some variables. When defining variables, Jenkinsfile supports declaring variables in single quotes and double quotes. I didn't pay attention to the difference between the two at first, but I kept getting errors when using it. It will not be automatically recognized as a variable value, but the expression will be passed directly into the command.

At the beginning of the script, I declare a variable:

		// Harbor 项目名称
        PROJECT_NAME = 'tjxm'
        // 镜像名称
        REPOSITORY = 'dev-tp-manager'
        

Guess you like

Origin blog.csdn.net/linmengmeng_1314/article/details/127413907