pass variables as parameters t obash

main
Nicolas Arenas 2025-03-18 00:00:55 +01:00
parent c29c04f964
commit e1a154b91e
1 changed files with 57 additions and 61 deletions

View File

@ -1,7 +1,5 @@
def call(String repoDir, String maintainerName = "Qindel Opengnsys Team", String maintainerEmail = "opengnsys@qindel.com") { sh """#!/bin/bash
script { exec bash <<'EOF'
sh """
#!/bin/bash
set -e # Detener la ejecución en caso de error set -e # Detener la ejecución en caso de error
set -x # Mostrar los comandos que se ejecutan set -x # Mostrar los comandos que se ejecutan
@ -31,7 +29,7 @@ def call(String repoDir, String maintainerName = "Qindel Opengnsys Team", String
version_block_started=false version_block_started=false
while IFS= read -r line || [[ -n "\$line" ]]; do while IFS= read -r line || [[ -n "\$line" ]]; do
if [[ "\$line" =~ ^##\ \[(.*)\]\ -\ ([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})\$ ]]; then if [[ "\$line" =~ ^##\\ \\[(.*)\\]\\ -\\ ([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})\$ ]]; then
if [ "\$first_entry" = false ] && [ "\$version_block_started" = true ]; then if [ "\$first_entry" = false ] && [ "\$version_block_started" = true ]; then
echo -e " -- \$MAINTAINER_NAME <\$MAINTAINER_EMAIL> \$(date -R)\\n" >> "\$OUTPUT_FILE" echo -e " -- \$MAINTAINER_NAME <\$MAINTAINER_EMAIL> \$(date -R)\\n" >> "\$OUTPUT_FILE"
fi fi
@ -46,9 +44,9 @@ def call(String repoDir, String maintainerName = "Qindel Opengnsys Team", String
echo -e "\$PACKAGE_NAME (\$VERSION) \$DISTRIBUTION; urgency=\$URGENCY\\n" >> "\$OUTPUT_FILE" echo -e "\$PACKAGE_NAME (\$VERSION) \$DISTRIBUTION; urgency=\$URGENCY\\n" >> "\$OUTPUT_FILE"
elif [[ "\$line" =~ ^###\ (.*) ]]; then elif [[ "\$line" =~ ^###\\ (.*) ]]; then
echo -e " * \${BASH_REMATCH[1]}" >> "\$OUTPUT_FILE" echo -e " * \${BASH_REMATCH[1]}" >> "\$OUTPUT_FILE"
elif [[ "\$line" =~ ^-\ (.*) ]]; then elif [[ "\$line" =~ ^-\\ (.*) ]]; then
echo -e " - \${BASH_REMATCH[1]}" >> "\$OUTPUT_FILE" echo -e " - \${BASH_REMATCH[1]}" >> "\$OUTPUT_FILE"
elif [[ -z "\$line" ]]; then elif [[ -z "\$line" ]]; then
echo "" >> "\$OUTPUT_FILE" echo "" >> "\$OUTPUT_FILE"
@ -60,7 +58,5 @@ def call(String repoDir, String maintainerName = "Qindel Opengnsys Team", String
fi fi
echo "✅ Changelog generado en formato Debian en \$OUTPUT_FILE." echo "✅ Changelog generado en formato Debian en \$OUTPUT_FILE."
EOF
""" """
}
}