Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special characters in last commit message break build #158

Closed
tjaeschke opened this issue Nov 22, 2019 · 1 comment
Closed

Special characters in last commit message break build #158

tjaeschke opened this issue Nov 22, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@tjaeschke
Copy link
Member

tjaeschke commented Nov 22, 2019

Describe the bug
The shared lib version comes with a newline special char, which breaks the build. This only happens, if the shard lib version is the last env variable.

The command env | grep 'library.ods-library.version' | cut -d= -f2 doesn't trimm linefeeds and has to be extended to env | grep 'library.ods-library.version' | cut -d= -f2 | tr -d '\n\r'

To Reproduce
Ensure that the lib version is the last env variable and start a build

Expected behavior
The shared lib version doen't have any special characters

Affected version (please complete the following information):

  • OpenShift: 3.11
  • OpenDevStack all

Log Output (ensure to remove any confidential information like tokens, project names, etc.

[prov-cd-ods-provisioning-app-production] Running shell script
+ oc patch bc prov-app --type=json --patch '[{"op": "replace", "path": "/spec/source", "value": {"type":"Binary"}},{"op": "replace", "path": "/spec/output/to/name", "value": "prov-app:5-3431c12f"},{"op": "replace", "path": "/spec/output/imageLabels", "value": [
        {"name":"ods.build.source.repo.url","value":"http://cd_user@192.168.56.31:7990/scm/opendevstack/ods-provisioning-app.git"},{"name":"ods.build.source.repo.commit.sha","value":"3431c12f503c91bb6bf1ddd9cd76d08bbba4b25d"},{"name":"ods.build.source.repo.commit.msg","value":"Merge branch master of https://github.com/opendevstack/ods-provisioning-app into #283 � Conflicts: �	src/main/resources/application.properties"},{"name":"ods.build.source.repo.commit.author","value":"Torsten Jaeschke (torsten.jaeschke@opitz-consulting.com)"},{"name":"ods.build.source.repo.commit.timestamp","value":"2019-11-22 13:00:13 +0100"},{"name":"ods.build.source.repo.branch","value":"production"},{"name":"ods.build.jenkins.job.url","value":"https://jenkins-prov-cd.192.168.56.101.nip.io/job/prov-cd/job/prov-cd-ods-provisioning-app-production/5/"},{"name":"ods.build.timestamp","value":"Fri Nov 22 12:48:32 UTC 2019"},{"name":"ods.build.lib.version","value":"production
"}
      ]}]' -n prov-test
error: unable to parse "[{\"op\": \"replace\", \"path\": \"/spec/source\", \"value\": {\"type\":\"Binary\"}},{\"op\": \"replace\", \"path\": \"/spec/output/to/name\", \"value\": \"prov-app:5-3431c12f\"},{\"op\": \"replace\", \"path\": \"/spec/output/imageLabels\", \"value\": [\n        {\"name\":\"ods.build.source.repo.url\",\"value\":\"http://cd_user@192.168.56.31:7990/scm/opendevstack/ods-provisioning-app.git\"},{\"name\":\"ods.build.source.repo.commit.sha\",\"value\":\"3431c12f503c91bb6bf1ddd9cd76d08bbba4b25d\"},{\"name\":\"ods.build.source.repo.commit.msg\",\"value\":\"Merge branch master of https://github.com/opendevstack/ods-provisioning-app into #283 \x01 Conflicts: \x01\tsrc/main/resources/application.properties\"},{\"name\":\"ods.build.source.repo.commit.author\",\"value\":\"Torsten Jaeschke (torsten.jaeschke@opitz-consulting.com)\"},{\"name\":\"ods.build.source.repo.commit.timestamp\",\"value\":\"2019-11-22 13:00:13 +0100\"},{\"name\":\"ods.build.source.repo.branch\",\"value\":\"production\"},{\"name\":\"ods.build.jenkins.job.url\",\"value\":\"https://jenkins-prov-cd.192.168.56.101.nip.io/job/prov-cd/job/prov-cd-ods-provisioning-app-production/5/\"},{\"name\":\"ods.build.timestamp\",\"value\":\"Fri Nov 22 12:48:32 UTC 2019\"},{\"name\":\"ods.build.lib.version\",\"value\":\"production\n\"}\n      ]}]": yaml: control characters are not allowed

Additional context
OdsContext.groovy L48

@tjaeschke tjaeschke added the bug Something isn't working label Nov 22, 2019
@tjaeschke
Copy link
Member Author

The reason is not the linefeed, but seems to be a windows specific control character in the commit message.

@tjaeschke tjaeschke changed the title Special characters in lib version break build Special characters in lastr commit message break build Nov 22, 2019
@tjaeschke tjaeschke changed the title Special characters in lastr commit message break build Special characters in last commit message break build Nov 22, 2019
michaelsauter pushed a commit to BIX-Digital/ods-jenkins-shared-library that referenced this issue Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Development

No branches or pull requests

2 participants