Skip to content

Commit

Permalink
fix godoc version (#190)
Browse files Browse the repository at this point in the history
* update version

Signed-off-by: Kosuke Morimoto <ksk@vdaas.org>

* replace embedded version string

Signed-off-by: Kosuke Morimoto <ksk@vdaas.org>

* replace embedded version string

Signed-off-by: Kosuke Morimoto <ksk@vdaas.org>

* 🤖 auto update stage ⬆️

Signed-off-by: vdaas-ci <ci@vdaas.org>

* refactor

Signed-off-by: Kosuke Morimoto <ksk@vdaas.org>

---------

Signed-off-by: Kosuke Morimoto <ksk@vdaas.org>
Signed-off-by: vdaas-ci <ci@vdaas.org>
Co-authored-by: vdaas-ci <ci@vdaas.org>
  • Loading branch information
kmrmt and vdaas-ci authored May 23, 2024
1 parent 93ea65d commit 363c216
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 22 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ $(VERSION_DOC_FILES): \
$(call create-content-file,$@)
@cat $(patsubst content/docs/v$(TARGET_TAG)/%.md,tmp/$(SYNC_REPO_PATH)/docs/%.md,$@) >> $@


# contents/update/root or tag updates each content files
# It includes updating document, fixing document link path and fixing image file path for each target content.
.PHONY: contents/update/root contents/update/tag
Expand All @@ -164,6 +163,8 @@ contents/update/root: \
@find content/docs -type f -name "*.md" -not -path "content/docs/v*" | xargs -I{} mage -d ./magefile ConvertLinks {} $(TARGET_TAG)
@echo "\e[1;33mset metadata...\e[0m"
@find content/docs -type f -name "*.md" -not -path "content/docs/v*" | xargs -I{} mage -d ./magefile UpdateMetadata {}
@echo "\e[1;33membed version...\e[0m"
@find content/docs -type f -name "*.md" -not -path "content/docs/v*" | xargs -I{} mage -d ./magefile EmbedVersion {} $(TARGET_TAG) $(TARGET_VER)

contents/update/tag: \
$(VERSION_DOC_FILES)
Expand All @@ -182,6 +183,8 @@ contents/update/tag: \
@find content/docs/v$(TARGET_TAG) -type f -name "*.md" | xargs -I{} mage -d ./magefile ConvertLinks {} $(TARGET_TAG)
@echo "\e[1;33mset metadata...\e[0m"
@find content/docs/v$(TARGET_TAG) -type f -name "*.md" | xargs -I{} mage -d ./magefile UpdateMetadata {}
@echo "\e[1;33membed version...\e[0m"
@find content/docs/v$(TARGET_TAG) -type f -name "*.md" | xargs -I{} mage -d ./magefile EmbedVersion {} $(TARGET_TAG) $(TARGET_VER)

# contents/publish/root or tag toggle draft value to false for each contents file.
.PHONY: contents/publish/root contents/publish/tag
Expand Down Expand Up @@ -209,7 +212,6 @@ define create-content-file
else \
hugo new --kind index $(1) >/dev/null ; \
fi

endef

define create-index-file
Expand Down
6 changes: 3 additions & 3 deletions content/docs/overview/component/agent.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Agent_overview/Component"
date: 2024-02-15T17:10:08+09:00
date: 2024-05-23T16:15:24+09:00
draft: false
weight: 100
description: Stores index data and Search ANN vectors
Expand Down Expand Up @@ -85,9 +85,9 @@ You have to wait to complete the CreateIndex and SaveIndex functions before sear

This image shows the mechanism to create NGT index.

<img src="/images/overview/component/agent/ngt.png" />
<img src="/images/overview/component/agent/ngt.png" alt="NGT Index Creation Mechanism" />

Please refer to [Go Doc](https://pkg.go.dev/github.com/vdaas/vald@v1.3.1/pkg/agent/core/ngt/service) for other functions.
Please refer to [Go Doc](https://pkg.go.dev/github.com/vdaas/vald/pkg/agent/core/ngt/service) for other functions.

#### Vald Agent Faiss

Expand Down
2 changes: 1 addition & 1 deletion content/docs/v1.4/overview/component/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ This image shows the mechanism to create NGT index.

<img src="/images/v1.4/overview/component/agent/ngt.png" />

Please refer to [Go Doc](https://pkg.go.dev/github.com/vdaas/vald@v1.3.1/pkg/agent/core/ngt/service) for other functions.
Please refer to [Go Doc](https://pkg.go.dev/github.com/vdaas/vald@v1.4.1/pkg/agent/core/ngt/service) for other functions.

### Sidecar

Expand Down
2 changes: 1 addition & 1 deletion content/docs/v1.5/overview/component/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ This image shows the mechanism to create NGT index.

<img src="/images/v1.5/overview/component/agent/ngt.png" />

Please refer to [Go Doc](https://pkg.go.dev/github.com/vdaas/vald@v1.3.1/pkg/agent/core/ngt/service) for other functions.
Please refer to [Go Doc](https://pkg.go.dev/github.com/vdaas/vald@v1.5.6/pkg/agent/core/ngt/service) for other functions.

### Sidecar

Expand Down
2 changes: 1 addition & 1 deletion content/docs/v1.6/overview/component/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ This image shows the mechanism to create NGT index.

<img src="/images/v1.6/overview/component/agent/ngt.png" />

Please refer to [Go Doc](https://pkg.go.dev/github.com/vdaas/vald@v1.3.1/pkg/agent/core/ngt/service) for other functions.
Please refer to [Go Doc](https://pkg.go.dev/github.com/vdaas/vald@v1.6.3/pkg/agent/core/ngt/service) for other functions.

### Sidecar

Expand Down
2 changes: 1 addition & 1 deletion content/docs/v1.7/overview/component/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ This image shows the mechanism to create NGT index.

<img src="/images/v1.7/overview/component/agent/ngt.png" />

Please refer to [Go Doc](https://pkg.go.dev/github.com/vdaas/vald@v1.3.1/pkg/agent/core/ngt/service) for other functions.
Please refer to [Go Doc](https://pkg.go.dev/github.com/vdaas/vald@v1.7.12/pkg/agent/core/ngt/service) for other functions.

#### Vald Agent Faiss

Expand Down
39 changes: 27 additions & 12 deletions magefile/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ const ORIGINAL_GO_VERSION = "https://raw.githubusercontent.com/vdaas/vald/main/v
const LATEST_VERSION_FILE = "../VERSIONS/VALD_LATEST_VERSION"
const GO_VERSION_FILE = "../VERSIONS/GO_VERSION"
const HUGO_HEADER = "../themes/vald/layouts/partials/header.html"
const METADATE_PATH = "../description.json"
const METADATA_PATH = "../description.json"
const VERSION_EMBEDDING_STRING = "@VERSION@"

type metadata struct {
weight int
Expand Down Expand Up @@ -183,8 +184,7 @@ func ConvertLinks(path, tag string) error {
path = "../" + path
b, err := os.ReadFile(path)
if err != nil {
fmt.Println("failed to read file: %s", err.Error())
return err
return fmt.Errorf("failed to read file: %s", err.Error())
}
str := string(b)
additionalPath := ""
Expand Down Expand Up @@ -215,15 +215,13 @@ func UpdateMetadata(path string) error {
path = "../" + path
b, err := os.ReadFile(path)
if err != nil {
fmt.Println("failed to read file: %s", err.Error())
return err
return fmt.Errorf("failed to read file: %s", err.Error())
}
str := string(b)
// read json
d, err := os.ReadFile(METADATE_PATH)
d, err := os.ReadFile(METADATA_PATH)
if err != nil {
fmt.Println("failed to read file: %s", err.Error())
return err
return fmt.Errorf("failed to read file: %s", err.Error())
}
var meta map[string]interface{}
json.Unmarshal(d, &meta)
Expand Down Expand Up @@ -284,8 +282,7 @@ func Publish(path string) error {
path = "../" + path
b, err := os.ReadFile(path)
if err != nil {
fmt.Println("failed to read file: %s", err.Error())
return err
return fmt.Errorf("failed to read file: %s", err.Error())
}
str := string(b)
str = strings.Replace(str, "draft: true", "draft: false", 1)
Expand All @@ -297,10 +294,28 @@ func UnPublish(path string) error {
path = "../" + path
b, err := os.ReadFile(path)
if err != nil {
fmt.Println("failed to read file: %s", err.Error())
return err
return fmt.Errorf("failed to read file: %s", err.Error())
}
str := string(b)
str = strings.Replace(str, "draft: false", "draft: true", 1)
return os.WriteFile(path, []byte(str), os.ModePerm)
}

// EmbedVersion replaces the target string to version
func EmbedVersion(path, tag, version string) error {
path = "../" + path
b, err := os.ReadFile(path)
if err != nil {
return fmt.Errorf("failed to read file: %s", err.Error())
}
str := string(b)
if tag != "main" && tag != "" {
version = "@v" + version
} else {
version = ""
}
// replace VERSION_EMBEDDING_STRING to version
str = strings.ReplaceAll(str, VERSION_EMBEDDING_STRING, version)

return os.WriteFile(path, []byte(str), os.ModePerm)
}

0 comments on commit 363c216

Please sign in to comment.