Skip to content

Commit

Permalink
Separate checkout strategies more cleanly (#135)
Browse files Browse the repository at this point in the history
* Separated checkout strategies to separate independent implementations, using the checkoutStrategy interface.

* If commit, branch and tag is specified, no longer adding branch ref to the fetch command. This is the same behavior as checking out commit+branch, the fetch is not branch specific.

* Created Exported parameters to serve as a public API (for describe the required input parameters for all checkout methods). (To be used in the webhook handler)

* Submodule update is moved after checkout, as it is independent from other checkout actions (after detaching head).
  • Loading branch information
lpusok authored Mar 9, 2021
1 parent 58f7ec4 commit 83f2734
Show file tree
Hide file tree
Showing 48 changed files with 1,570 additions and 5,998 deletions.
120 changes: 0 additions & 120 deletions Gopkg.lock

This file was deleted.

20 changes: 0 additions & 20 deletions Gopkg.toml

This file was deleted.

82 changes: 65 additions & 17 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ workflows:
- _test_hosted_git_notfork
- _test_unrelated_histories
- _test_hosted_git_ssh_prefix
- test_diff_file

_test_submodule:
before_run:
Expand Down Expand Up @@ -576,6 +577,70 @@ workflows:
inputs:
- dir_to_check: $CLONE_INTO_DIR

test_diff_file:
before_run:
- _create_tmpdir
steps:
- script:
inputs:
- content: |-
#!/bin/env bash
set -ex
DIFF_DIR=$(pwd)/diff_dir
GIT_DIR=$(pwd)/repoA
PR_GIT_DIR=$(pwd)/repoB
CLONE_DIR=$(pwd)/cloneDir
mkdir ${GIT_DIR}
mkdir ${PR_GIT_DIR}
mkdir ${DIFF_DIR}
mkdir ${CLONE_DIR}
# Repo A
cd ${GIT_DIR}
git init
echo "aabbccdd" > README.md
git add .
git commit -m "Initial commit A"
cd -
# Repo B (clone of Repo A)
cd ${PR_GIT_DIR}
git clone ${GIT_DIR} .
echo "eeffgghh" >>README.md
git add .
git commit -m "PR commit B"
# Diff files
git diff HEAD^ HEAD | tee -a ${DIFF_DIR}/diff.txt
cd -
# Set envs
envman add --key CLONE_INTO_DIR --value ${CLONE_DIR}
envman add --key GIT_REPOSITORY_URL --value ${GIT_DIR}
envman add --key PR_REPOSITORY_URL --value ${PR_GIT_DIR}
envman add --key BITRISE_BUILD_URL --value "file://${DIFF_DIR}"
- path::./:
run_if: true
inputs:
- repository_url: $GIT_REPOSITORY_URL
- clone_into_dir: $CLONE_INTO_DIR
- pull_request_id: 8
- pull_request_repository_url: $PR_REPOSITORY_URL
- pull_request_merge_branch: ""
- branch_dest: "master"
- branch: "master"
- commit: ""
- tag: ""
- clone_depth: "1"
- manual_merge: "no"
- script:
inputs:
- content: |-
#!/bin/bash
set -ex
eval "$EVAL_SCRIPT"
diff ${CLONE_INTO_DIR}/README.md ${PR_REPOSITORY_URL}/README.md
_test_too_long_commit_message:
before_run:
- _create_tmpdir
Expand Down Expand Up @@ -621,23 +686,6 @@ workflows:
inputs:
- path: $STEP_TMPDIR

# ----------------------------------------------------------------
# --- Utility workflows
dep-update:
title: Dep update
description: |
Used for updating bitrise dependencies with dep
steps:
- script:
title: Dependency update
inputs:
- content: |-
#!/bin/bash
set -ex
go get -u -v github.com/golang/dep/cmd/dep
dep ensure -v
dep ensure -v -update
# ----------------------------------------------------------------
# --- workflow to Share this step into a Step Library
audit-this-step:
Expand Down
Loading

0 comments on commit 83f2734

Please sign in to comment.