Skip to content

Fix super-linter: fetch full git history to resolve master branch lookup failure#61

Merged
electrocucaracha merged 4 commits intomasterfrom
copilot/fix-lint-devstack-issue
Mar 23, 2026
Merged

Fix super-linter: fetch full git history to resolve master branch lookup failure#61
electrocucaracha merged 4 commits intomasterfrom
copilot/fix-lint-devstack-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 23, 2026

super-linter was fatally failing on PRs because the shallow checkout (fetch-depth: 1) left no master/origin/master ref available — which super-linter requires to diff changed files when VALIDATE_ALL_CODEBASE is unset.

Changes

  • .github/workflows/linter.yml — add fetch-depth: 0 to the actions/checkout step in check-super-linter so all branches (including master) are fetched, unblocking super-linter's diff-based file filtering.
  • ci/update_distros.sh — fix shfmt -i 4 -s formatting: align case patterns in _get_box_arch with the case/esac keywords (shfmt canonical style), resolving the "Check scripts format" CI failure.

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

…cut delimiter

Co-authored-by: electrocucaracha <2782150+electrocucaracha@users.noreply.github.com>
Agent-Logs-Url: https://github.com/electrocucaracha/lint-devstack/sessions/7b31e12b-7e74-4978-af45-9aea5894c7bb
Copilot AI changed the title [WIP] Fix issue in lint devstack action Fix check-versions CI: stale Vagrant Cloud URLs and invalid cut delimiter Mar 23, 2026
Copilot AI requested a review from electrocucaracha March 23, 2026 02:49
Copilot AI changed the title Fix check-versions CI: stale Vagrant Cloud URLs and invalid cut delimiter Fix Vagrant Cloud URL deprecation and shell formatting in update_distros.sh Mar 23, 2026
…h available

Co-authored-by: electrocucaracha <2782150+electrocucaracha@users.noreply.github.com>
Agent-Logs-Url: https://github.com/electrocucaracha/lint-devstack/sessions/075df27f-8e9d-4ce5-875c-46a7df4da1da
Copilot AI changed the title Fix Vagrant Cloud URL deprecation and shell formatting in update_distros.sh Fix super-linter: fetch full git history to resolve master branch lookup failure Mar 23, 2026
@electrocucaracha electrocucaracha marked this pull request as ready for review March 23, 2026 05:04
@qodo-code-review
Copy link
Copy Markdown

ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan

Review Summary by Qodo

Fix CI issues: super-linter, Vagrant Cloud API, and script formatting

🐞 Bug fix ✨ Enhancement

Grey Divider

Walkthroughs

Description
• Fix super-linter CI by fetching full git history for master branch availability
• Update Vagrant Cloud API URLs from v1 to v2 with architecture support
• Add _get_box_arch function to detect and map system architecture
• Fix shell script formatting and improve Vagrantfile cut delimiter handling
Diagram
flowchart LR
  A["CI Workflows"] -->|fetch-depth: 0| B["super-linter"]
  B -->|full git history| C["master branch available"]
  D["Vagrant Cloud API"] -->|v1 to v2 migration| E["update_distros.sh"]
  E -->|architecture detection| F["_get_box_arch function"]
  G["Vagrantfile"] -->|improved delimiter| H["VBoxManage parsing"]
Loading

Grey Divider

File Changes

1. .github/workflows/linter.yml 🐞 Bug fix +1/-0

Enable full git history for super-linter

• Add fetch-depth: 0 to actions/checkout step in check-super-linter job
• Enables full git history fetch to make master branch available for super-linter's diff-based
 file filtering

.github/workflows/linter.yml


2. ci/update_distros.sh ✨ Enhancement +13/-3

Migrate to Vagrant Cloud API v2 with architecture support

• Update Vagrant Cloud API endpoint from https://app.vagrantup.com/api/v1/box/ to
 https://vagrantcloud.com/api/v2/vagrant/
• Change python to python3 for JSON parsing
• Add new _get_box_arch function to detect system architecture (x86_64→amd64, aarch64→arm64)
• Update box download URL to include architecture path: providers/$PROVIDER/$arch/vagrant.box

ci/update_distros.sh


3. Vagrantfile 🐞 Bug fix +1/-1

Improve VBoxManage output parsing robustness

• Replace cut -d "Name:[ ]*" -f 2 delimiter with awk '{$1=""; sub(/^[[:space:]]+/, ""); print}'
 for more robust VBoxManage output parsing
• Improves handling of whitespace in bridged interface name extraction

Vagrantfile


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review bot commented Mar 23, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 📐 Spec deviations (0)

Grey Divider


Action required

1. Retry loop bypassed 🐞 Bug ⛯ Reliability
Description
In ci/update_distros.sh, _get_box_current_version is intended to retry fetching metadata, but
under set -o errexit any JSON parse error (or missing current_version.version) will abort the
script immediately, bypassing the retry loop. This can happen when the curl response is a non-JSON
error page or an API error payload that doesn’t match the expected shape.
Code

ci/update_distros.sh[R30-33]

+            metadata="$(curl -s "https://vagrantcloud.com/api/v2/vagrant/${name%/*}/${name#*/}")"
            if [ "$metadata" ]; then
-                version="$(echo "$metadata" | python -c 'import json,sys;print(json.load(sys.stdin)["current_version"]["version"])')"
+                version="$(echo "$metadata" | python3 -c 'import json,sys;print(json.load(sys.stdin)["current_version"]["version"])')"
                break
Evidence
The script enables set -o errexit, then treats any non-empty curl response body as valid JSON and
immediately runs python3 -c 'json.load(...)...["current_version"]["version"]'. If that python
process exits non-zero (invalid JSON, KeyError), bash exits the whole script due to errexit, so
the surrounding until loop never retries and max_attempts is effectively unused for these
failures.

ci/update_distros.sh[11-40]
ci/update_distros.sh[20-44]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`_get_box_current_version` uses an `until` retry loop, but with `set -o errexit` the script exits on JSON parse/KeyError before any retries can occur. This makes transient API/HTTP failures fatal.

### Issue Context
- The curl call does not fail the shell on HTTP errors (no `--fail`), so error pages/bodies can still be non-empty.
- The python3 JSON extraction is unguarded and will exit non-zero on invalid JSON or unexpected response shape.

### Fix Focus Areas
- ci/update_distros.sh[11-40]
- ci/update_distros.sh[20-44]

### Implementation notes
- Capture both HTTP status and body, e.g. `curl -fsSL -w &#x27;%{http_code}&#x27;` (or `--fail-with-body`) and only attempt JSON parsing on 2xx.
- Make the JSON extraction non-fatal inside the loop, e.g.:
 - `version=$(python3 -c &#x27;...&#x27; &lt;&lt;&lt;&quot;$metadata&quot; 2&gt;/dev/null || true)`
 - Only `break` when `version` is non-empty.
- If parsing fails, increment `attempt_counter` and continue retrying until `max_attempts` is reached (then exit 1 with a helpful message including HTTP code).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@electrocucaracha electrocucaracha merged commit 0e6ddf1 into master Mar 23, 2026
10 of 12 checks passed
@electrocucaracha electrocucaracha deleted the copilot/fix-lint-devstack-issue branch March 23, 2026 05:13
Comment on lines +30 to 33
metadata="$(curl -s "https://vagrantcloud.com/api/v2/vagrant/${name%/*}/${name#*/}")"
if [ "$metadata" ]; then
version="$(echo "$metadata" | python -c 'import json,sys;print(json.load(sys.stdin)["current_version"]["version"])')"
version="$(echo "$metadata" | python3 -c 'import json,sys;print(json.load(sys.stdin)["current_version"]["version"])')"
break
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Retry loop bypassed 🐞 Bug ⛯ Reliability

In ci/update_distros.sh, _get_box_current_version is intended to retry fetching metadata, but
under set -o errexit any JSON parse error (or missing current_version.version) will abort the
script immediately, bypassing the retry loop. This can happen when the curl response is a non-JSON
error page or an API error payload that doesn’t match the expected shape.
Agent Prompt
### Issue description
`_get_box_current_version` uses an `until` retry loop, but with `set -o errexit` the script exits on JSON parse/KeyError before any retries can occur. This makes transient API/HTTP failures fatal.

### Issue Context
- The curl call does not fail the shell on HTTP errors (no `--fail`), so error pages/bodies can still be non-empty.
- The python3 JSON extraction is unguarded and will exit non-zero on invalid JSON or unexpected response shape.

### Fix Focus Areas
- ci/update_distros.sh[11-40]
- ci/update_distros.sh[20-44]

### Implementation notes
- Capture both HTTP status and body, e.g. `curl -fsSL -w '%{http_code}'` (or `--fail-with-body`) and only attempt JSON parsing on 2xx.
- Make the JSON extraction non-fatal inside the loop, e.g.:
  - `version=$(python3 -c '...' <<<"$metadata" 2>/dev/null || true)`
  - Only `break` when `version` is non-empty.
- If parsing fails, increment `attempt_counter` and continue retrying until `max_attempts` is reached (then exit 1 with a helpful message including HTTP code).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants