Merge ~kzapalowicz/snappy-hwe-snaps/+git/build-scripts:fix/snap-version-issue into ~snappy-hwe-team/snappy-hwe-snaps/+git/build-scripts:master

Proposed by Konrad Zapałowicz
Status: Merged
Approved by: Jim Hodapp
Approved revision: e82f413650d6a89f56b79bbfeafbc5275419e84b
Merged at revision: 88eb9b7b3803837874d40407372e63de1777471d
Proposed branch: ~kzapalowicz/snappy-hwe-snaps/+git/build-scripts:fix/snap-version-issue
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/build-scripts:master
Diff against target: 12 lines (+1/-1)
1 file modified
jobs/generic-build-snap-worker (+1/-1)
Reviewer Review Type Date Requested Status
Jim Hodapp (community) Approve
System Enablement Bot continuous-integration Approve
Review via email: mp+319982@code.launchpad.net

This proposal supersedes a proposal from 2017-03-15.

Description of the change

Fix empty snap name for files with comments on top.

Some snapcraft.yaml files have a header that contains
commented-out version information. Due to that the name is not
within first five lines.

This commit makes the snap name rule skip the lines that start
with the comment '#'

To post a comment you must log in.
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jim Hodapp (jhodapp) wrote :

LGTM

review: Approve
Revision history for this message
Jim Hodapp (jhodapp) wrote :

I also tested this locally against as many snap projects as I could. Seems like a solid change.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/jobs/generic-build-snap-worker b/jobs/generic-build-snap-worker
2index 504edd8..d9ab177 100755
3--- a/jobs/generic-build-snap-worker
4+++ b/jobs/generic-build-snap-worker
5@@ -49,7 +49,7 @@ REPO_NAME=$(awk -v a="$TARGET_GIT_REPO" 'BEGIN{print substr(a, index(a, "+git/")
6 # We rely on the snapcraft.yaml to have the snap name in the first five lines
7 # which is the case for all our snaps. This is a bit lazy but the best way to
8 # ensure we don't fetch any other name: fields which might be present in the file.
9-SNAP_NAME=$(head -n 5 snapcraft.yaml | grep "^name:" | awk '{print $2}')
10+SNAP_NAME=$(cat snapcraft.yaml | grep -v ^\# | head -n 5 | grep "^name:" | awk '{print $2}')
11 SNAP_REV=$(git rev-parse --short HEAD)
12 CI_REPO=$REPO_NAME-$BUILD_ID-$SNAP_REV
13

Subscribers

People subscribed via source and target branches