Skip to content

Commit da2b8e6

Browse files
authored
Fixing how CI builds remote properties (#3582)
* Fixing how CI builds remote properties * Backporting CookieCutter PR branch CI
1 parent 78b109e commit da2b8e6

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

.github/workflows/cookiecutters-test.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,23 @@ on:
2020

2121
jobs:
2222

23+
# -------- Retrieve target branches for fprime-tools and fprime-bootstrap --------
24+
get-tools-branch:
25+
name: "Get fprime-tools target branch"
26+
uses: ./.github/workflows/reusable-get-pr-branch.yml
27+
with:
28+
target_repository: nasa/fprime-tools
29+
30+
get-bootstrap-branch:
31+
name: "Get fprime-bootstrap target branch"
32+
uses: ./.github/workflows/reusable-get-pr-branch.yml
33+
with:
34+
target_repository: nasa/fprime-bootstrap
35+
36+
# -------- Install target versions of the cookiecutter templates and validate -------
2337
Validate:
2438
runs-on: ubuntu-latest
39+
needs: [ get-tools-branch, get-bootstrap-branch ]
2540
steps:
2641
# Checkout only the bootstrap.expect file, since the full F´ repo will be
2742
# checked out as part of the fprime-bootstrap process
@@ -38,11 +53,11 @@ jobs:
3853
with:
3954
python-version: '3.11'
4055

41-
- name: "Install expect and fprime-bootstrap@devel"
56+
- name: "Install expect and fprime-bootstrap"
4257
run: |
4358
sudo apt-get install expect
44-
pip install git+https://github.com/fprime-community/fprime-bootstrap@devel
45-
59+
pip install git+https://github.com/fprime-community/fprime-bootstrap@${{ needs.get-bootstrap-branch.outputs.target-branch }}
60+
4661
- name: "Bootstrap Project"
4762
run: |
4863
expect .github/actions/cookiecutter-check/bootstrap.expect
@@ -56,12 +71,12 @@ jobs:
5671
path: ./MyProject/lib/fprime
5772
fetch-depth: 0
5873

59-
- name: "Update dependencies and install fprime-tools@devel"
74+
- name: "Update dependencies and install fprime-tools"
6075
run: |
6176
cd MyProject
6277
. fprime-venv/bin/activate
6378
pip install -U -r ./lib/fprime/requirements.txt
64-
pip install git+https://github.com/nasa/fprime-tools@devel
79+
pip install git+https://github.com/nasa/fprime-tools@${{ needs.get-tools-branch.outputs.target-branch }}
6580
6681
- name: "Version Check"
6782
run: |

.github/workflows/reusable-get-pr-branch.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,14 @@ jobs:
2929
- name: "Get target branch"
3030
id: get_target_branch
3131
run: |
32-
response_code=`curl -w '%{response_code}' https://api.github.com/repos/${{ inputs.target_repository }}/branches/pr-${{ github.event.number }} -o /dev/null`
33-
if [[ "${{ github.event_name }}" == "pull_request" && "$response_code" == "200" ]]; then
32+
response_code_pr=`curl -w '%{response_code}' https://api.github.com/repos/${{ inputs.target_repository }}/branches/pr-${{ github.event.number }} -o /dev/null`
33+
response_code_base=`curl -w '%{response_code}' https://api.github.com/repos/${{ inputs.target_repository }}/branches/${{ github.event.pull_request.base.ref }} -o /dev/null`
34+
if [[ "${{ github.event_name }}" == "pull_request" && "$response_code_pr" == "200" ]]; then
3435
echo "TARGET_BRANCH=pr-${{ github.event.number }}" >> $GITHUB_OUTPUT
3536
echo "PR branch found, using pr-${{ github.event.number }}"
37+
elif [[ "${{ github.event_name }}" == "pull_request" && "$response_code_base" == "200" ]]; then
38+
echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_OUTPUT
39+
echo "Base branch found, using ${{ github.event.pull_request.base.ref }}"
3640
else
3741
echo "TARGET_BRANCH=${{ inputs.default_target_ref }}" >> $GITHUB_OUTPUT
3842
echo "PR branch not found, using ${{ inputs.default_target_ref }}"

0 commit comments

Comments
 (0)