From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 3/3] .gitlab-ci.yml: add trigger per job
Date: Sun, 9 Dec 2018 21:59:21 +0100 [thread overview]
Message-ID: <20181209215921.3a29dc23@windsurf> (raw)
In-Reply-To: <20181028235839.22472-4-ricardo.martincoski@gmail.com>
Hello,
On Sun, 28 Oct 2018 20:58:39 -0300, Ricardo Martincoski wrote:
> diff --git a/support/scripts/generate-gitlab-ci-yml b/support/scripts/generate-gitlab-ci-yml
> index d824f669b5..9efa775f88 100755
> --- a/support/scripts/generate-gitlab-ci-yml
> +++ b/support/scripts/generate-gitlab-ci-yml
> @@ -7,14 +7,31 @@ output="${2}"
>
> cp "${input}" "${output}"
>
> +d_only_in=$(
> + awk '/^\.defconfig:/{x=1;next}/^[^ ]/{x=0}x' "${input}" \
> + | awk '/^ only/{x=1;next}/^ [^ ]/{x=0}x'
> +)
> +d_only=$( \
> + printf ":\n <<: *defconfig\n only:\n%s\n - /-" "$d_only_in"
> +)
> +
> (
> cd configs
> LC_ALL=C ls -1 *_defconfig
> ) \
> - | sed 's/$/: *defconfig/' \
> + | awk -v o="$d_only" '{i=$0; gsub(/\./,"\\.",i); print $0 o i "$/"}' \
> >> "${output}"
>
> +r_only_in=$(
> + awk '/^\.runtime_test:/{x=1;next}/^[^ ]/{x=0}x' "${input}" \
> + | awk '/^ only/{x=1;next}/^ [^ ]/{x=0}x'
> +)
> +r_only=$(
> + printf ":\n <<: *runtime_test\n only:\n%s\n - /-" "$r_only_in"
> +)
> +
> ./support/testing/run-tests -l 2>&1 \
> - | sed -r -e '/^test_run \((.*)\).*/!d; s//\1: *runtime_test/' \
> + | sed -r -e '/^test_run \((.*)\).*/!d; s//\1/' \
> | LC_ALL=C sort \
> + | awk -v o="$r_only" '{i=$0; gsub(/\./,"\\.",i); print $0 o i "$/"}' \
> >> "${output}"
I'm very confused by all this awk sorcery, and looking at the output, I
wonder if something simpler like this wouldn't be better:
diff --git a/support/scripts/generate-gitlab-ci-yml b/support/scripts/generate-gitlab-ci-yml
index 431911d370..110de0b207 100755
--- a/support/scripts/generate-gitlab-ci-yml
+++ b/support/scripts/generate-gitlab-ci-yml
@@ -10,8 +10,29 @@ cat "${input}"
cd configs
LC_ALL=C ls -1 *_defconfig
) \
- | sed 's/$/: *defconfig/'
+ | while read defconfig; do
+ cat <<EOF
+${defconfig}:
+ <<: *defconfig
+ only:
+ - triggers
+ - tags
+ - /-defconfigs\$/
+ - /-${defconfig}\$/
+EOF
+ done
./support/testing/run-tests -l 2>&1 \
- | sed -r -e '/^test_run \((.*)\).*/!d; s//\1: *runtime_test/' \
- | LC_ALL=C sort
+ | sed -r -e '/^test_run \((.*)\).*/!d; s//\1/' \
+ | LC_ALL=C sort \
+ | while read runtest; do
+ cat <<EOF
+${runtest}:
+ <<: *runtime_test
+ only:
+ - triggers
+ - tags
+ - /-runtime-tests\$/
+ - /-${runtest//./\\.}\$/
+EOF
+done
This produces an output that is exactly identical to the one done by
your awk magic, and I personally find this shell based implementation a
lot simpler and easier to read. What do you think ?
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2018-12-09 20:59 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-28 23:58 [Buildroot] [PATCH 0/3] .gitlab-ci.yml: add trigger per job and per type of job Ricardo Martincoski
2018-10-28 23:58 ` [Buildroot] [PATCH 1/3] .gitlab-ci.yml: add trigger " Ricardo Martincoski
2018-12-09 20:29 ` Thomas Petazzoni
2018-10-28 23:58 ` [Buildroot] [PATCH 2/3] Makefile: offload .gitlab-ci.yml generation Ricardo Martincoski
2018-12-09 20:32 ` Thomas Petazzoni
2018-10-28 23:58 ` [Buildroot] [PATCH 3/3] .gitlab-ci.yml: add trigger per job Ricardo Martincoski
2018-12-09 20:59 ` Thomas Petazzoni [this message]
2019-01-16 22:57 ` Ricardo Martincoski
2018-12-10 13:30 ` Matthew Weber
2018-12-13 16:55 ` Matthew Weber
2019-01-09 14:57 ` Matthew Weber
2019-01-11 2:52 ` Ricardo Martincoski
2019-01-16 22:45 ` [Buildroot] [PATCH v2] " Ricardo Martincoski
2019-01-18 10:21 ` Arnout Vandecappelle
2019-01-20 20:21 ` Ricardo Martincoski
2019-01-21 1:11 ` [Buildroot] [PATCH v3 0/5] .gitlab-ci.yml: rework and " Ricardo Martincoski
2019-01-21 1:11 ` [Buildroot] [PATCH v3 1/5] .gitlab-ci.yml: use "extends" keyword Ricardo Martincoski
2019-02-06 10:53 ` Arnout Vandecappelle
2019-01-21 1:11 ` [Buildroot] [PATCH v3 2/5] .gitlab-ci.yml: use "include" keyword Ricardo Martincoski
2019-02-06 10:59 ` Arnout Vandecappelle
2019-04-08 3:22 ` Ricardo Martincoski
2019-01-21 1:11 ` [Buildroot] [PATCH v3 3/5] .gitlab-ci.yml: reorder jobs Ricardo Martincoski
2019-01-21 1:11 ` [Buildroot] [PATCH v3 4/5] .gitlab-ci.yml: prepare to reuse scripts Ricardo Martincoski
2019-01-21 1:11 ` [Buildroot] [PATCH v3 5/5] .gitlab-ci.yml: add trigger per job Ricardo Martincoski
2019-04-08 3:22 ` [Buildroot] [PATCH v4 0/3] .gitlab-ci.yml: rework and " Ricardo Martincoski
2019-04-08 3:22 ` [Buildroot] [PATCH v4 1/3] .gitlab-ci.yml: reorder jobs Ricardo Martincoski
2019-04-13 13:43 ` Arnout Vandecappelle
2019-04-08 3:22 ` [Buildroot] [PATCH v4 2/3] .gitlab-ci.yml: prepare to reuse scripts Ricardo Martincoski
2019-04-08 3:22 ` [Buildroot] [PATCH v4 3/3] .gitlab-ci.yml: add trigger per job Ricardo Martincoski
2019-04-13 13:46 ` Arnout Vandecappelle
2019-04-22 1:27 ` Ricardo Martincoski
2019-04-22 7:19 ` Arnout Vandecappelle
2019-05-01 13:54 ` Arnout Vandecappelle
2018-10-31 9:13 ` [Buildroot] [PATCH 0/3] .gitlab-ci.yml: add trigger per job and per type of job Thomas Petazzoni
2018-11-02 4:22 ` Ricardo Martincoski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181209215921.3a29dc23@windsurf \
--to=thomas.petazzoni@bootlin.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox