Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ on:
required: false
default: ""
type: string
source_url:
required: false
default: ""
type: string
use_pr_source_url:
required: false
default: false
type: boolean
use_prbranch_as_build_branch:
required: false
default: false
Expand Down Expand Up @@ -59,17 +67,26 @@ jobs:
if [ -z "${branch}" ]; then
branch="${{ fromJson(steps.request.outputs.data).head.ref }}"
fi
if ${{ inputs.use_pr_source_url }}; then
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In .github/workflows/build_and_test.yml:70, the use_pr_source_url path assumes steps.request.outputs.data contains valid PR JSON and immediately runs fromJson(...). For non-PR callers (e.g., workflow_dispatch or other workflow_call users), the request route may be empty and fromJson/field access can fail.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

source_url="${{ fromJson(steps.request.outputs.data).head.repo.clone_url }}"
else
source_url="${{ inputs.source_url }}"
fi
SOURCE_URL_OPT=""
if [ -n "${source_url}" ]; then
SOURCE_URL_OPT="-F PORT_SOURCE_URL=${source_url}"
fi
BUILD_BRANCH_OPT=""
if ${{ inputs.use_prbranch_as_build_branch }}; then
BUILD_BRANCH_OPT="-F BUILD_BRANCH=${branch}"
branch="main"
fi
CAUSE="Triggered by GH Action from PR: ${{ github.event.issue.pull_request.url || github.event.pull_request.url }} - Repo ${repo}, Branch: ${branch}, Build Opts: ${BUILD_BRANCH_OPT}"
CAUSE="Triggered by GH Action from PR: ${{ github.event.issue.pull_request.url || github.event.pull_request.url }} - Repo ${repo}, Branch: ${branch}, Source URL: ${source_url}, Build Opts: ${BUILD_BRANCH_OPT}"

ENCODED_CAUSE=$(echo -n "$CAUSE" | jq -s -R -r @uri)
JENKINS_JOB_URL="${{ vars.JENKINS_HOST_URL }}/job/Port-Build/buildWithParameters?token=jenkinstest&cause=${ENCODED_CAUSE}"

RESPONSE=$(curl -k -X POST -s -i -u "${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_API_TOKEN }}" "${JENKINS_JOB_URL}" -F PORT_GITHUB_REPO="${repo}" -F PORT_DESCRIPTION="Github CI Test of ${repo}" -F PORT_BRANCH="${branch}" ${BUILD_BRANCH_OPT})
RESPONSE=$(curl -k -X POST -s -i -u "${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_API_TOKEN }}" "${JENKINS_JOB_URL}" -F PORT_GITHUB_REPO="${repo}" -F PORT_DESCRIPTION="Github CI Test of ${repo}" -F PORT_BRANCH="${branch}" ${SOURCE_URL_OPT} ${BUILD_BRANCH_OPT})

# Extract the build URL from the response headers
BUILD_URL=$(echo "$RESPONSE" | grep -oP "location: \K(.*)" | tr -d '\r')
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/jenkins-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ jobs:
secrets: inherit
with:
repo: 'https://github.com/zopencommunity/metaport.git'
use_pr_source_url: true
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In .github/workflows/jenkins-test.yml:28, use_pr_source_url: true is passed for all triggers, including workflow_dispatch where there is no PR payload. That can cause the called workflow to try to read PR API data that doesn’t exist (or fail the request step), so the manual dispatch path may break.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

use_prbranch_as_build_branch: true
22 changes: 16 additions & 6 deletions bin/zopen-build
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ Required:
stable build URL (either git or tarball).

Optional:
ZOPEN_SOURCE_URL If set, use this as ZOPEN_URL before checking
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In bin/zopen-build:53, help text adds ZOPEN_SOURCE_URL as an override, but the “Required” section above still states ZOPEN_DEV_URL/ZOPEN_STABLE_URL are required for DEV/STABLE builds. With the new behavior, those URLs aren’t required when ZOPEN_SOURCE_URL is set, so the help output is now misleading.

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

ZOPEN_DEV_URL or ZOPEN_STABLE_URL.
ZOPEN_EXTRA_CFLAGS C compiler flags to append to CFLAGS (defaults to '').
ZOPEN_EXTRA_CPPFLAGS C,C++ pre-processor flags to append to CPPFLAGS.
(defaults to '')
Expand Down Expand Up @@ -628,10 +630,14 @@ checkEnv()
printError "Building from dev, but ZOPEN_DEV_DEPS not specified"
fi
ZOPEN_DEPS="${ZOPEN_DEV_DEPS}"
if [ -z "${ZOPEN_DEV_URL}" ]; then
printError "Building from dev, but ZOPEN_DEV_URL not specified"
if [ ! -z "${ZOPEN_SOURCE_URL}" ]; then
ZOPEN_URL="${ZOPEN_SOURCE_URL}"
else
if [ -z "${ZOPEN_DEV_URL}" ]; then
printError "Building from dev, but ZOPEN_DEV_URL not specified"
fi
ZOPEN_URL="${ZOPEN_DEV_URL}"
fi
ZOPEN_URL="${ZOPEN_DEV_URL}"
if [ ! -z "${ZOPEN_DEV_BRANCH}" ]; then
export ZOPEN_GIT_BRANCH="${ZOPEN_DEV_BRANCH}"
fi
Expand All @@ -653,10 +659,14 @@ checkEnv()
printError "Building from stable, but ZOPEN_STABLE_DEPS not specified"
fi
ZOPEN_DEPS="${ZOPEN_STABLE_DEPS}"
if [ -z "${ZOPEN_STABLE_URL}" ]; then
printError "Building from stable, but ZOPEN_STABLE_URL not specified"
if [ ! -z "${ZOPEN_SOURCE_URL}" ]; then
ZOPEN_URL="${ZOPEN_SOURCE_URL}"
else
if [ -z "${ZOPEN_STABLE_URL}" ]; then
printError "Building from stable, but ZOPEN_STABLE_URL not specified"
fi
ZOPEN_URL="${ZOPEN_STABLE_URL}"
fi
ZOPEN_URL="${ZOPEN_STABLE_URL}"
if [ ! -z "${ZOPEN_STABLE_BRANCH}" ]; then
export ZOPEN_GIT_BRANCH="${ZOPEN_STABLE_BRANCH}"
fi
Expand Down
4 changes: 4 additions & 0 deletions cicd/build.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Inputs:
# - PORT_GITHUB_REPO : e.g: https://github.com/zopencommunity/makeport.git
# - PORT_BRANCH : (default: main)
# - PORT_SOURCE_URL : optional alternate source URL passed through to zopen-build as ZOPEN_SOURCE_URL
# - BUILD_LINE: dev or stable
# - FORCE_CLANG : Build using clang
# Output:
Expand Down Expand Up @@ -52,6 +53,9 @@ fi
if [ ! -z "$BUILD_BRANCH" ]; then
export ZOPEN_GIT_BRANCH="$BUILD_BRANCH"
fi
if [ ! -z "$PORT_SOURCE_URL" ]; then
export ZOPEN_SOURCE_URL="$PORT_SOURCE_URL"
fi
git clone -b "${PORT_BRANCH}" "${PORT_GITHUB_REPO}" ${PORT_NAME} && cd ${PORT_NAME}

# Always run tests and update dependencies and generate pax file
Expand Down
Loading