yegor256 / rultor

DevOps team assistant that helps you merge, deploy, and release GitHub-hosted apps and libraries
https://www.rultor.com
Other
562 stars 157 forks source link

Rultor fails to parse a valid yaml #1312

Open Glusk opened 5 years ago

Glusk commented 5 years ago

This is the .rultor.yml file I am using:

architect:
  - Glusk2
docker:
  image: "mingc/android-build-box:1.12.0"
release:
  script:
    - "chmod +x gradlew"
    # Increment versionCode
    - "perl -i.orig -pe '/versionCode/ && s/([0-9]+)/$1+1 . $2/e' android/build.gradle"
    # Strip tag of the "v" prefix
    - "version=${tag#'v'}"
    # Bump project version
    - "./gradlew release -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=$version -Prelease.newVersion=$version-SNAPSHOT"

The online parser classifies it as a valid yml and parses it successfully. YAMLlint also confirms that it is in fact a valid .yml file!

However, invoking rultor like this:

@rultor release, tag=v0.9.0

failed with this error message (full log):

/home/r/script.sh: line 9: unexpected EOF while looking for matching `}'
0crat commented 5 years ago

@yegor256/z please, pay attention to this issue

0crat commented 5 years ago

@glusk2/z this project will fix the problem faster if you donate a few dollars to it; just click here and pay via Stripe, it's very fast, convenient and appreciated; thanks a lot!

Glusk commented 5 years ago

@rultor config

@glusk2 This is how I understand the .rultor.yml file in the root directory of your base branch:

<?xml version="1.0" encoding="UTF-8"?>
<p>
   <entry key="architect">
      <item>Glusk2</item>
   </entry>
   <entry key="docker">
      <entry key="image">mingc/android-build-box:1.12.0</entry>
   </entry>
   <entry key="release">
      <entry key="script">
         <item>chmod +x gradlew</item>
         <item>perl -i.orig -pe '/versionCode/ &amp;&amp; s/([0-9]+)/$1+1 . $2/e' android/build.gradle</item>
         <item>version=${tag#'v'}</item>
         <item>./gradlew release -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=$version -Prelease.newVersion=$version-SNAPSHOT</item>
      </entry>
   </entry>
</p>

This page explains how to configure it.

Originally posted by @rultor in https://github.com/Glusk2/sprouts/issues/163#issuecomment-544206038


The following script line:

- "version=${tag#'v'}"

is successfully stored as an XML element in rultor store:

 <item>version=${tag#'v'}</item>

but on rultor execution it degenerates into:

version=${tag`#'\''\'\'''\''v'\''\'\'''\''}`
yegor256 commented 4 years ago

@Glusk2 the problem still exists?

Glusk commented 4 years ago

@yegor256 I have since migrated the project to another automated release solution.

But the issue is still present in rultor.


Minimal reproducible example

.rultor.yml:

architect:
  - Glusk2
release:
  script:
    - "version=${tag#'v'}"

Such configuration would fail upon invoking rultor like this:

@rultor release, tag=v1.0.0


It does seem futile to undo all the effort that was put into dealing with the comment lines and make significant changes to how rultor starts its builds (as suggested here)

But as it stands, the following commands will not work in .rultor.yml:

Resource: Shell Parameter Expansion

Glusk commented 4 years ago

@yegor256

Unfortunately the information on the topic of this issue is scattered between several other issues.

Here is a list of my comments in related issues:

This is a full list of related issues: