mirror of
https://github.com/hanzoai/cd.git
synced 2026-10-30 14:56:45 +00:00
Rewrites remaining Argo/ArgoCD/argocd/argoproj prose in docs/ to Hanzo CD,
in our own voice only. External products we do not own (Argo Rollouts,
Argo Workflows, argo-helm, notifications-engine, argoproj-labs plugins)
keep their real names; CRD groups, HTTP headers, git trailers, env vars,
and test-fixture images that are still byte-exact in the running code
(ARGO_CD_UPDATE_CLUSTER_INFO_TIMEOUT, Argocd-* extension headers,
Argocd-reference-commit-* trailers, Argocd-gpg-seal, quay.io/argoprojlabs
cd-e2e-container) are left untouched.
Deletes docs/operator-manual/upgrading/1.0-1.1.md through 3.4-3.5.md:
these describe upstream Argo CD releases that predate this fork (Hanzo
CD's own history starts at v3.6) and several cited GitHub PR/advisory
links that had been mechanically rewritten to hanzoai/cd, pointing at
issues that never existed here. Deletes docs/developer-guide/dependencies.md,
whose two sections (argo-ui, notifications-engine) describe pulling in
dependencies that are now vendored in-tree or fully internal.
Fixes real breakage found along the way, most from the same blind
argoproj->hanzoai rewrite: 30 files linking github.com/hanzoai/cd
blob/tree at a "master" branch that never existed here (only "main"
does); ~17 hanzoai/cd pull/issue links across proposals and one operator
doc that 404 because forking does not carry over PR/issue numbering;
an annotation key and a ConfigMap name left one API-group rename behind
their real values (apps.hanzo.ai/*, cd-rbac-cm); a page rename
(Argo-CD-Integration.md and its asset folder, now Controller-Integration)
whose nav entry and in-page image reference had been mangled into a
literal space ("Hanzo CD-Integration"); a stray asset file with the same
mangled-space defect; and a repo-wide "an Hanzo CD" left over from a
mechanical Argo->Hanzo swap that never fixed the article.
mkdocs.yml: trims the Upgrading nav to the one real entry, drops
dependencies.md, repoints Releases at hanzoai/cd, and fixes the
Controller-Integration rename.
Verified with a strict mkdocs build (0 warnings) after the fixes above.
Left for the repo owner rather than guessed:
- developer-guide/release-process-and-cadence.md and
proposals/feature-bounties*.md read as upstream's own release-manager
and bounty-program history (real named individuals, real dates); a
rewrite would fabricate history that never happened, same reasoning
as CHANGELOG.md.
- assets/versions.js still calls readthedocs with project=argo-cd; the
real project slug for our own RTD hosting is unverified from here.
- signed-release-assets.md's cosign --certificate-identity-regexp still
names .github/workflows/image-reuse.yaml, which does not exist in this
repo (no .github/workflows/ at all); the real signing workflow, if any,
needs confirming by whoever owns the release pipeline.
- maintaining-internal-cd-forks.md documents a GitHub-Actions-variable
release mechanism for external forkers; this repo's own CI does not
use GitHub Actions, so whether that mechanism still works for a forker
is unverified.
156 lines
5.8 KiB
JavaScript
156 lines
5.8 KiB
JavaScript
const targetNode = document.querySelector('.md-header__inner');
|
|
const observerOptions = {
|
|
childList: true,
|
|
subtree: true
|
|
};
|
|
|
|
const VERSION_REGEX = /\/en\/(release-(?:v\d+|[\d\.]+|\w+)|latest|stable)\//;
|
|
|
|
const observerCallback = function(mutationsList, observer) {
|
|
for (let mutation of mutationsList) {
|
|
if (mutation.type === 'childList') {
|
|
const titleElement = document.querySelector('.md-header__inner > .md-header__title');
|
|
if (titleElement) {
|
|
initializeVersionDropdown();
|
|
observer.disconnect();
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
const observer = new MutationObserver(observerCallback);
|
|
observer.observe(targetNode, observerOptions);
|
|
|
|
function getCurrentVersion() {
|
|
const currentVersion = window.location.href.match(VERSION_REGEX);
|
|
if (currentVersion && currentVersion.length > 1) {
|
|
return currentVersion[1];
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function initializeVersionDropdown() {
|
|
const callbackName = 'callback_' + new Date().getTime();
|
|
window[callbackName] = function(response) {
|
|
const div = document.createElement('div');
|
|
div.innerHTML = response.html;
|
|
const headerTitle = document.querySelector(".md-header__inner > .md-header__title");
|
|
if (headerTitle) {
|
|
headerTitle.appendChild(div);
|
|
}
|
|
|
|
const container = div.querySelector('.rst-versions');
|
|
if (!container) return; // Exit if container not found
|
|
|
|
// Add caret icon
|
|
var caret = document.createElement('div');
|
|
caret.innerHTML = "<i class='fa fa-caret-down dropdown-caret'></i>";
|
|
caret.classList.add('dropdown-caret');
|
|
const currentVersionElem = div.querySelector('.rst-current-version');
|
|
if (currentVersionElem) {
|
|
currentVersionElem.appendChild(caret);
|
|
}
|
|
|
|
// Add click listener to toggle dropdown
|
|
if (currentVersionElem && container) {
|
|
currentVersionElem.addEventListener('click', function() {
|
|
container.classList.toggle('shift-up');
|
|
});
|
|
}
|
|
|
|
// Sorting Logic
|
|
sortVersionLinks(container);
|
|
};
|
|
|
|
// Load CSS
|
|
var CSSLink = document.createElement('link');
|
|
CSSLink.rel = 'stylesheet';
|
|
CSSLink.href = '/assets/versions.css';
|
|
document.getElementsByTagName('head')[0].appendChild(CSSLink);
|
|
|
|
// Load JSONP Script
|
|
var script = document.createElement('script');
|
|
const currentVersion = getCurrentVersion();
|
|
script.src = 'https://argo-cd.readthedocs.io/_/api/v2/footer_html/?' +
|
|
'callback=' + callbackName + '&project=argo-cd&page=&theme=mkdocs&format=jsonp&docroot=docs&source_suffix=.md&version=' + (currentVersion || 'latest');
|
|
document.getElementsByTagName('head')[0].appendChild(script);
|
|
}
|
|
|
|
// Function to sort version links
|
|
function sortVersionLinks(container) {
|
|
// Find all <dl> elements within the container
|
|
const dlElements = container.querySelectorAll('dl');
|
|
|
|
dlElements.forEach(dl => {
|
|
const ddElements = Array.from(dl.querySelectorAll('dd'));
|
|
|
|
// Check if ddElements contain version links
|
|
const isVersionDl = ddElements.some(dd => {
|
|
const link = dd.querySelector('a');
|
|
return VERSION_REGEX.test(link?.getAttribute?.('href'));
|
|
});
|
|
|
|
// This dl contains version links, proceed to sort
|
|
if (isVersionDl) {
|
|
// Define sorting criteria
|
|
ddElements.sort((a, b) => {
|
|
const aText = a.textContent.trim().toLowerCase();
|
|
const bText = b.textContent.trim().toLowerCase();
|
|
|
|
// Prioritize 'latest' and 'stable'
|
|
if (aText === 'latest') return -1;
|
|
if (bText === 'latest') return 1;
|
|
if (aText === 'stable') return -1;
|
|
if (bText === 'stable') return 1;
|
|
|
|
// Extract version numbers (e.g., release-2.9)
|
|
const aVersionMatch = aText.match(/release-(\d+(\.\d+)*)/);
|
|
const bVersionMatch = bText.match(/release-(\d+(\.\d+)*)/);
|
|
|
|
if (aVersionMatch && bVersionMatch) {
|
|
const aVersion = aVersionMatch[1].split('.').map(Number);
|
|
const bVersion = bVersionMatch[1].split('.').map(Number);
|
|
|
|
for (let i = 0; i < Math.max(aVersion.length, bVersion.length); i++) {
|
|
const aNum = aVersion[i] || 0;
|
|
const bNum = bVersion[i] || 0;
|
|
if (aNum > bNum) return -1;
|
|
if (aNum < bNum) return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
// Fallback to alphabetical order
|
|
return aText.localeCompare(bText);
|
|
});
|
|
|
|
// Remove existing <dd> elements
|
|
ddElements.forEach(dd => dl.removeChild(dd));
|
|
|
|
// Append sorted <dd> elements
|
|
ddElements.forEach(dd => dl.appendChild(dd));
|
|
}
|
|
});
|
|
}
|
|
|
|
// VERSION WARNINGS
|
|
window.addEventListener("DOMContentLoaded", function() {
|
|
var margin = 30;
|
|
var headerHeight = document.getElementsByClassName("md-header")[0].offsetHeight;
|
|
const currentVersion = getCurrentVersion();
|
|
if (currentVersion && currentVersion !== "stable") {
|
|
var stableUrl = window.location.href.replace(VERSION_REGEX, '/en/stable/');
|
|
if (currentVersion === "latest") {
|
|
document.querySelector("div[data-md-component=announce]").innerHTML = "<div id='announce-msg'>You are viewing the docs for an unreleased version of Hanzo CD, <a href='" + stableUrl + "'>view the latest stable version.</a></div>";
|
|
} else {
|
|
document.querySelector("div[data-md-component=announce]").innerHTML = "<div id='announce-msg'>You are viewing the docs for a previous version of Hanzo CD, <a href='" + stableUrl + "'>view the latest stable version.</a></div>";
|
|
}
|
|
var bannerHeight = document.getElementById('announce-msg').offsetHeight + margin;
|
|
document.querySelector("header.md-header").style.top = bannerHeight + "px";
|
|
document.querySelector('style').textContent +=
|
|
"@media screen and (min-width: 76.25em){ .md-sidebar { height: 0; top:" + (bannerHeight + headerHeight) + "px !important; }}";
|
|
document.querySelector('style').textContent +=
|
|
"@media screen and (min-width: 60em){ .md-sidebar--secondary { height: 0; top:" + (bannerHeight + headerHeight) + "px !important; }}";
|
|
}
|
|
});
|