Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: test link test (#15334)

p0nya3b43fcf4ad0
diff --git a/README.md b/README.md
index 1a2b71da39..3a653f4e37 100644
--- a/README.md
+++ b/README.md
@@ -13,8 +13,8 @@
</h1>
<p align="center">
- <a href="https://bytebase.com/docs/get-started/install/overview" target="_blank"><b>⚙️ Install</b></a> •
- <a href="https://bytebase.com/docs"><b>📚 Docs</b></a> •
+ <a href="https://bytebase.com/docs/get-started/self-host" target="_blank"><b>⚙️ Install</b></a> •
+ <a href="https://bytebase.com/docs/introduction/what-is-bytebase"><b>📚 Docs</b></a> •
<a href="https://discord.gg/huyw7gRsyA"><b>💬 Discord</b></a> •
<a href="https://www.bytebase.com/request-demo/"><b>🙋‍♀️ Book Demo</b></a>
</p>
@@ -147,7 +147,7 @@ Bytebase is a Database CI/CD solution for the Developers and DBAs. It's the **on
# 🔧 Installation
-- [Docker](https://www.bytebase.com/docs/get-started/install/deploy-with-docker)
+- [Docker](https://www.bytebase.com/docs/get-started/self-host/)
- [Kubernetes](https://www.bytebase.com/docs/get-started/install/deploy-to-kubernetes)
- [Build from source](https://www.bytebase.com/docs/get-started/install/build-from-source-code)
diff --git a/frontend/src/components/IssueV1/components/StatementSection/SDLView/SDLView.vue b/frontend/src/components/IssueV1/components/StatementSection/SDLView/SDLView.vue
index b39604867d..e4d6113d23 100644
--- a/frontend/src/components/IssueV1/components/StatementSection/SDLView/SDLView.vue
+++ b/frontend/src/components/IssueV1/components/StatementSection/SDLView/SDLView.vue
@@ -26,12 +26,6 @@
</template>
<div class="whitespace-nowrap">
<span>{{ $t("issue.sdl.left-schema-may-change") }}</span>
- <LearnMoreLink
- url="https://www.bytebase.com/docs/change-database/state-based-migration/?source=console#caveats"
- color="light"
- class="ml-1"
- hide-when-embedded
- />
</div>
</NTooltip>
</div>
@@ -93,7 +87,6 @@ import { reactive } from "vue";
import { BBSpin } from "@/bbkit";
import { FeatureModal } from "@/components/FeatureGuard";
import { useIssueContext } from "@/components/IssueV1/logic";
-import LearnMoreLink from "@/components/LearnMoreLink.vue";
import { DiffEditor, MonacoEditor } from "@/components/MonacoEditor";
import { hasFeature, pushNotification } from "@/store";
import { useSQLAdviceMarkers } from "../useSQLAdviceMarkers";
diff --git a/frontend/src/components/ProfileDropdown.vue b/frontend/src/components/ProfileDropdown.vue
index 5c85abdfdf..5497156842 100644
--- a/frontend/src/components/ProfileDropdown.vue
+++ b/frontend/src/components/ProfileDropdown.vue
@@ -304,7 +304,7 @@ const options = computed((): DropdownOption[] => [
{
class: "menu-item",
target: "_blank",
- href: "https://bytebase.com/docs?source=console",
+ href: "https://bytebase.com/docs/introduction/what-is-bytebase/?source=console",
},
t("common.help")
);
diff --git a/frontend/src/components/Project/ProjectReleasesPanel.vue b/frontend/src/components/Project/ProjectReleasesPanel.vue
index 944cead003..8c6e3ea130 100644
--- a/frontend/src/components/Project/ProjectReleasesPanel.vue
+++ b/frontend/src/components/Project/ProjectReleasesPanel.vue
@@ -3,7 +3,7 @@
<NAlert type="info">
<span>{{ $t("release.usage-description") }}</span>
<LearnMoreLink
- url="https://www.bytebase.com/docs/vcs-integration/custom/release/?source=console"
+ url="https://www.bytebase.com/docs/vcs-integration/release/?source=console"
class="ml-1"
/>
</NAlert>
diff --git a/frontend/src/components/ReleaseRemindModal.vue b/frontend/src/components/ReleaseRemindModal.vue
index d406a435ff..d5f4f7ea2f 100644
--- a/frontend/src/components/ReleaseRemindModal.vue
+++ b/frontend/src/components/ReleaseRemindModal.vue
@@ -44,7 +44,7 @@ const subscriptionStore = useSubscriptionV1Store();
const link = computed(() => {
if (subscriptionStore.isSelfHostLicense) {
- return "https://www.bytebase.com/docs/get-started/install/overview";
+ return "https://www.bytebase.com/docs/get-started/self-host";
}
return subscriptionStore.purchaseLicenseUrl;
});
diff --git a/frontend/src/components/SensitiveData/GlobalMaskingRulesView.vue b/frontend/src/components/SensitiveData/GlobalMaskingRulesView.vue
index a0eec47122..44f93bb0af 100644
--- a/frontend/src/components/SensitiveData/GlobalMaskingRulesView.vue
+++ b/frontend/src/components/SensitiveData/GlobalMaskingRulesView.vue
@@ -51,7 +51,7 @@
<div class="textinfolabel">
{{ $t("settings.sensitive-data.global-rules.description") }}
<LearnMoreLink
- url="https://www.bytebase.com/docs/security/mask-data?source=console"
+ url="https://www.bytebase.com/docs/security/data-masking/overview/?source=console"
/>
</div>
<NoDataPlaceholder v-if="state.maskingRuleItemList.length === 0" />
diff --git a/frontend/src/views/BannerDemo.vue b/frontend/src/views/BannerDemo.vue
index 601d38d1b3..f76ad79884 100644
--- a/frontend/src/views/BannerDemo.vue
+++ b/frontend/src/views/BannerDemo.vue
@@ -18,7 +18,7 @@
class="flex flex-row space-x-4 order-3 my-2 flex-shrink-0 w-full sm:order-2 sm:py-1 sm:my-0 sm:w-auto"
>
<a
- href="https://bytebase.com/docs/get-started/install/deploy-with-docker?source=demo"
+ href="https://bytebase.com/docs/get-started/self-host/?source=demo"
target="_blank"
class="flex items-center justify-center pl-4 pr-2 py-1 border border-transparent rounded-sm text-base font-medium text-accent bg-white hover:bg-indigo-50"
>
diff --git a/go.mod b/go.mod
index 09f79790ae..4f725df93f 100644
--- a/go.mod
+++ b/go.mod
@@ -88,6 +88,7 @@ require (
github.com/vjeantet/ldapserver v1.0.1
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8
github.com/xuri/excelize/v2 v2.9.0
+ github.com/yterajima/go-sitemap v0.4.0
github.com/zeebo/xxh3 v1.0.2
go.mongodb.org/mongo-driver v1.17.2
go.uber.org/multierr v1.11.0
diff --git a/go.sum b/go.sum
index d1eebe7c9c..8b08af9555 100644
--- a/go.sum
+++ b/go.sum
@@ -2036,6 +2036,8 @@ github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7/go.mod h1:WwHg+CVyzlv/TX9
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI=
+github.com/yterajima/go-sitemap v0.4.0 h1:JVgmfq4ch/XXIfKjSNlGqZudlPTBagNUgE6B9uBurm4=
+github.com/yterajima/go-sitemap v0.4.0/go.mod h1:CRU0eiLdQIFhxLoTQRgXlsPMNbENABe7h/l5+NGFNFw=
github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg=
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM=
github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc=
diff --git a/scripts/check_link_test.go b/scripts/check_link_test.go
index 21a1905fa9..5ea5054152 100644
--- a/scripts/check_link_test.go
+++ b/scripts/check_link_test.go
@@ -1,15 +1,16 @@
package tests
import (
- "io"
- "net/http"
+ "net/url"
"os"
"path/filepath"
"regexp"
+ "strings"
"testing"
"github.com/pkg/errors"
"github.com/stretchr/testify/require"
+ "github.com/yterajima/go-sitemap"
)
var (
@@ -28,18 +29,36 @@ var (
".vue": true,
}
+ ignoreLinks = map[string]bool{
+ "https://bytebase.com/changelog/bytebase-": true,
+ }
+
frontendDirectory = "../frontend"
)
func TestValidateLinks(t *testing.T) {
+ a := require.New(t)
links, err := extractLinkRecursive()
- require.NoError(t, err)
+ a.NoError(err)
+
+ sm, err := sitemap.Get("https://bytebase.com/sitemap.xml", nil)
+ a.NoError(err)
+
+ paths := map[string]struct{}{}
+ for _, smu := range sm.URL {
+ u, err := url.Parse(smu.Loc)
+ a.NoError(err)
+ paths[strings.TrimSuffix(u.Path, "/")] = struct{}{}
+ }
// Check all the links are reachable.
for link := range links {
- if err := checkLinkWithRetry(link); err != nil {
- require.NoError(t, err)
+ u, err := url.Parse(link)
+ a.NoError(err)
+ if ignoreLinks[link] {
+ continue
}
+ a.Contains(paths, strings.TrimSuffix(u.Path, "/"), link)
}
}
@@ -87,20 +106,3 @@ func extractLinkRecursive() (map[string]bool, error) {
return links, nil
}
-
-func checkLinkWithRetry(link string) error {
- // Request the link and check the response status code is 200.
- resp, err := http.Get(link)
- if err != nil {
- return errors.Wrapf(err, "failed to request link %q", link)
- }
- defer resp.Body.Close()
- b, err := io.ReadAll(resp.Body)
- if err != nil {
- return errors.Wrapf(err, "failed to read link %q", link)
- }
- if resp.StatusCode != http.StatusOK {
- return errors.Errorf("link %q returned status %q content %q", link, resp.Status, b)
- }
- return nil
-}