summaryrefslogtreecommitdiff
path: root/yarns/implementations.yarn
diff options
context:
space:
mode:
Diffstat (limited to 'yarns/implementations.yarn')
-rw-r--r--yarns/implementations.yarn70
1 files changed, 70 insertions, 0 deletions
diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn
index 8ed007b6..a28fda54 100644
--- a/yarns/implementations.yarn
+++ b/yarns/implementations.yarn
@@ -604,6 +604,72 @@ Generating a manifest.
die "Output isn't what we expect"
fi
+Implementations for temporary build branch handling
+---------------------------------------------------
+
+ IMPLEMENTS GIVEN the workspace contains no temporary build branches
+ build_ref_prefix=baserock/builds/
+ cd "$DATADIR/workspace"
+ # Want to use -execdir here, but busybox find doesn't support it
+ find . -name .git -print | while read gitdir; do (
+ cd "$(dirname "$gitdir")"
+ eval "$(git for-each-ref --shell \
+ --format='git update-ref -d %(refname) %(objectname)' \
+ "refs/heads/$build_ref_prefix")"
+ ); done
+
+ IMPLEMENTS GIVEN the git server contains no temporary build branches
+ build_ref_prefix=refs/heads/baserock/builds/
+ cd "$DATADIR/gits"
+ # Want to use -execdir here, but busybox find doesn't support it
+ find . -name .git -print | while read gitdir; do (
+ cd "$(dirname "$gitdir")"
+ eval "$(git for-each-ref --shell \
+ --format='git update-ref -d %(refname) %(objectname)' \
+ "$build_ref_prefix")"
+ git config receive.denyCurrentBranch ignore
+ rm -f .git/morph-pushed-branches
+ mkdir -p .git/hooks
+ cat >.git/hooks/post-receive <<'EOF'
+ #!/bin/sh
+ touch "$GIT_DIR/hook-ever-run"
+ exec cat >>"$GIT_DIR/morph-pushed-branches"
+ EOF
+ chmod +x .git/hooks/post-receive
+ ); done
+
+ IMPLEMENTS GIVEN we can build with local branches
+ sed -i -e '/push-build-branches/d' "$DATADIR/morph.conf"
+
+ IMPLEMENTS GIVEN we must build from pushed branches
+ cat >>"$DATADIR/morph.conf" <<'EOF'
+ push-build-branches = True
+ EOF
+
+ IMPLEMENTS THEN the (\S+) repository in the workspace for (\S+) has temporary build branches
+ build_ref_prefix=refs/heads/baserock/builds/
+ cd "$DATADIR/workspace/$MATCH_2/$(slashify_colons "test:$MATCH_1")"
+ git for-each-ref | grep -F "$build_ref_prefix"
+
+ IMPLEMENTS THEN the (\S+) repository in the workspace for (\S+) has no temporary build branches
+ build_ref_prefix=refs/heads/baserock/builds/
+ cd "$DATADIR/workspace/$MATCH_2/$(slashify_colons "test:$MATCH_1")"
+ if git for-each-ref | grep -F "$build_ref_prefix"; then
+ die Did not expect repo to contain build branches
+ fi
+
+ IMPLEMENTS THEN no temporary build branches were pushed to the (\S+) repository
+ build_ref_prefix=refs/heads/baserock/builds/
+ cd "$DATADIR/gits/$MATCH_1/.git"
+ if test -e morph-pushed-branches && grep -F "$build_ref_prefix" morph-pushed-branches; then
+ die Did not expect any pushed build branches
+ fi
+
+ IMPLEMENTS THEN temporary build branches were pushed to the (\S+) repository
+ build_ref_prefix=refs/heads/baserock/builds/
+ cd "$DATADIR/gits/$MATCH_1/.git"
+ test -e morph-pushed-branches && grep -F "$build_ref_prefix" morph-pushed-branches
+
Implementation sections for building
====================================
@@ -800,6 +866,10 @@ Implementations for building systems
cd "$DATADIR/workspace/$MATCH_3"
run_morph build "$MATCH_1"
+ IMPLEMENTS WHEN the user builds (\S+) of the (\S+) (branch|tag)
+ cd "$DATADIR/workspace/$MATCH_2"
+ run_morph build "$MATCH_1"
+
Implementations for tarball inspection
--------------------------------------