Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
alpine-gitlab-ci
alpine-gitlab-ci
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • alpine
    • infra
  • docker
  • alpine-gitlab-cialpine-gitlab-ci
  • Issues
  • #1

Closed
Open
Opened Feb 11, 2021 by Natanael Copa@ncopaOwner

CI does not fail on shell syntax errors in APKBUILDs

the CI gives success without building anything if one of the modified APKBUILDs has invalid shell syntax.

Something like this should fix it:

diff --git a/overlay/usr/local/bin/build.sh b/overlay/usr/local/bin/build.sh
index 378a2d5..ea69e23 100755
--- a/overlay/usr/local/bin/build.sh
+++ b/overlay/usr/local/bin/build.sh
@@ -103,6 +103,11 @@ changed_aports() {
 
        aports=$(git diff --name-only --diff-filter=ACMR --relative="$repo" \
                "$BASEBRANCH"...HEAD -- "*/APKBUILD" | xargs -I% dirname %)
+
+       for aports in $aports; do
+               ( cd $repo/$aport && . ./APKBUILD) || die "Failed to parse $aport"
+       done
+
        # $aports should remain unquoted
        # shellcheck disable=2086
        ap builddirs -d "$APORTSDIR/$repo" $aports 2>/dev/null | xargs -I% basename % | xargs
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: alpine/infra/docker/alpine-gitlab-ci#1