SVN get the last commit message offline

前端 未结 2 1159
时光说笑
时光说笑 2021-01-16 21:12

Is there a way to get the last commit message without access to the repo? svn log --limit 1 tries to connect to the repo.

EDIT: I have credentials setu

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-16 22:09

    This is what Jenkins Credentials plugin is for.

    You configure credentials securely on Jenkins Global Configuration, and let the job reference that. No need to write anything in the script.

    Edit:
    To securely use a password from within a shell step

    • Install EnvInject plugin.
    • Under Jenkins Global Configuration, find Global Passwords section.
    • Add a name (this will be the environment variable name) and password (will be starred **** ).
    • Under Job Configuration, find Build Environment section.
    • Checkmark Inject passwords to the build as environment variables.
    • Then checkmark Global passwords.

    In any build step, you can now use $name (as defined earlier) to refer to a password as you would if you were typing it in plain text.

    • The password variable is injected only at job execution time (typing $name on command line of the server by itself will not produce anything, and like all Jenkins variables, it is not persistent).
    • The job console log will show **** instead of password, if it appears.
    • You could configure passwords per job, rather than globally, so that other jobs can't use it.

    The only security concern is that if someone has administrative permissions to configure your job, they can write echo $name > secretpassword.txt into a build step, and then review the file in the workspace. But you should be careful who you assign administrative rights to.

提交回复
热议问题