Skip to content

[DOC-603] Simplify Toolchain Configuration handling #298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e1bd791
remove ARANGODB_BRANCH_ expansion in toolchain script init
Oct 19, 2023
050c01f
delete unused docker-compose.local file
Oct 19, 2023
bde98ad
delete unused hugo.deb and generateApiDocs.py files
Oct 19, 2023
dc976af
new toolchain config file
Oct 19, 2023
03a6bf2
docker-compose with no ARANGODB_SRC_VERSION variables and no ARANGODB…
Oct 19, 2023
9cbca02
Simplified toolchain config working locally
Oct 19, 2023
67aaa7c
try new toolchain config on circleci generate
Oct 19, 2023
d85f453
fix wrong filling of config.yml from circleci
Oct 19, 2023
452d3e6
fix typo config.yml
Oct 19, 2023
aa75e7b
new toolchain config for release job
Oct 19, 2023
0996904
add mv /tmp/version to /tmp/arangodb/version
Oct 19, 2023
76195bf
fix arangodb clone path
Oct 19, 2023
2690f4f
add missing -p in mkdir
Oct 19, 2023
00ddcdd
update how to add version with new toolchain config strategy
Oct 19, 2023
4292f5e
fix some typos in README
Oct 19, 2023
9d195aa
fix move
Oct 19, 2023
4cb24fe
fix move 2
Oct 19, 2023
63bc063
use another volume guest for ARANGODB_SRC local var
Oct 19, 2023
e86387c
fix configServers array bug
Oct 19, 2023
4aa72c3
adapt fixes to release job
Oct 19, 2023
96bd91c
use args.docs_version in mv release job
Oct 19, 2023
0d57dd4
replicate new config on arm64
Oct 20, 2023
67bd9e3
fix ARANGODB_SRC handling with new arangodb_src guest
Oct 20, 2023
aba7e86
update go.mod
Oct 20, 2023
bf52679
Merge branch 'main' into DOC-603
dandimeo Oct 23, 2023
c41e2bb
Merge branch 'main' of github.com:arangodb/docs-hugo into DOC-603
Oct 24, 2023
cc139c9
Update README.md
dandimeo Oct 25, 2023
c93b399
Merge branch 'main' into DOC-603
dandimeo Oct 25, 2023
7998449
use normal copy folder
Oct 25, 2023
c30d483
Merge branch 'DOC-603' of github.com:arangodb/docs-hugo into DOC-603
Oct 25, 2023
2dcbe08
try with partial copy
Oct 26, 2023
5e202b5
Merge branch 'main' into DOC-603
nerpaula Oct 30, 2023
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
2 changes: 1 addition & 1 deletion .circleci/base_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ jobs:
- "28:4f:0b:b7:71:cd:39:ab:c0:33:65:4f:da:6a:cc:8e"
- "bc:4d:f3:df:53:ad:22:d8:60:5d:10:d8:fd:74:d2:cd"
- attach_workspace:
at: .
at: /tmp

- run: ssh-keyscan github.com >> ~/.ssh/known_hosts && cat ~/.ssh/known_hosts
- clone-docs-and-merge
Expand Down
21 changes: 14 additions & 7 deletions .circleci/generate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ def workflow_generate_launch_command(config):
export HUGO_URL=https://<< pipeline.parameters.deploy-url >>--docs-hugo.netlify.app\n \
export HUGO_ENV=examples\n \
export OVERRIDE=<< pipeline.parameters.override >>\n \
export GENERATORS='<< parameters.generators >>'\n"
: > /home/circleci/project/docs-hugo/toolchain/docker/config.yaml\n \
echo 'generators: << parameters.generators >>' >> /home/circleci/project/docs-hugo/toolchain/docker/config.yaml\n\
echo 'servers:' >> /home/circleci/project/docs-hugo/toolchain/docker/config.yaml"

for i in range(len(versions)):
version = versions[i]["name"]
Expand All @@ -296,8 +298,9 @@ def workflow_generate_launch_command(config):

version_underscore = version.replace(".", "_")
branchEnv = f"{pullImage}\n \
export ARANGODB_BRANCH_{version_underscore}={branch}\n \
export ARANGODB_SRC_{version_underscore}=/home/circleci/project/{version}"
echo ' \"{version}\": \"{branch}\"' >> /home/circleci/project/docs-hugo/toolchain/docker/config.yaml\n\
mkdir -p /tmp/arangodb\n\
mv /tmp/{version} /tmp/arangodb/"

shell = f"{shell}\n{branchEnv}"

Expand Down Expand Up @@ -371,14 +374,18 @@ def workflow_release_launch_command(config):
export ENV=\"circleci\"\n \
export HUGO_URL=https://docs.arangodb.com\n \
export HUGO_ENV=release\n \
export GENERATORS=''\n"
: > /home/circleci/project/docs-hugo/toolchain/docker/config.yaml\n \
echo 'generators: \"\"' >> /home/circleci/project/docs-hugo/toolchain/docker/config.yaml\n\
echo 'servers:' >> /home/circleci/project/docs-hugo/toolchain/docker/config.yaml"

pullImage = pullImageCmd(args.arangodb_branch, args.docs_version)

version_underscore = args.docs_version.replace(".", "_")
branchEnv = f"{pullImage}\n \
export ARANGODB_BRANCH_{version_underscore}={args.arangodb_branch}\n \
export ARANGODB_SRC_{version_underscore}=/home/circleci/project/{args.docs_version}"
echo ' \"{args.docs_version}\": \"{args.arangodb_branch}\"' >> /home/circleci/project/docs-hugo/toolchain/docker/config.yaml\n\
mkdir -p /tmp/arangodb\n\
mv /tmp/{args.docs_version} /tmp/arangodb/"


shell = f"{shell}\n{branchEnv}"

Expand All @@ -402,7 +409,7 @@ def pullImageCmd(branch, version):
version={version}\n"
pullImage += "\
image_name=$(echo ${BRANCH##*/})\n\
main_hash=$(awk 'END{print}' $version/.git/logs/HEAD | awk '{print $2}' | cut -c1-9)\n\
main_hash=$(awk 'END{print}' /tmp/$version/.git/logs/HEAD | awk '{print $2}' | cut -c1-9)\n\
docker pull arangodb/docs-hugo:$image_name-$version-$main_hash\n\
docker tag arangodb/docs-hugo:$image_name-$version-$main_hash $image_name-$version"

Expand Down
80 changes: 11 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,9 @@ The toolchain container needs to be set up via config file in `toolchain/docker/

```yaml
generators: # Generators to trigger - empty string defaults to all generators
servers: # Array to define arangodb servers to be used by the toolchain
- image: # arangodb docker image to be used, can be arangodb/enterprise-preview:... or a branch name
version: # docs branch to put the generated content into
- ... # Additional images and versions as needed
servers: # define arangodb servers to be used by the toolchain
"{docs-version}": "{arangodb-branch}" # version folder of the documentation to put the generated content into: arangodb docker image to be used, can be arangodb/enterprise-preview:... or a branch name
...
```

**Available generators**
Expand All @@ -204,26 +203,22 @@ If `metrics` or `error-codes` is in the `generators` string, the following
environment variable has to be exported:

```shell
export ARANGODB_SRC_{VERSION}=path/to/arangodb/source
export ARANGODB_SRC=path/to/arangodb/source
```

Substitute `{VERSION}` with a version number like `3_11`.

On Windows using PowerShell, use a Unix-like path:

```powershell
$Env:ARANGODB_SRC_3_11 = "/Drive/path/to/arangodb"
$Env:ARANGODB_SRC = "/Drive/path/to/arangodb"
```

**Configuration example**

```yaml
generators: examples oasisctl options optimizer
servers:
- image: arangodb/enterprise-preview:3.11-nightly
version: "3.11"
- image: arangodb/enterprise-preview:devel-nightly
version: "3.12"
"3.11": "arangodb/enterprise-preview:3.11-nightly"
"3.12": "arangodb/enterprise-preview:devel-nightly"
```

**Run the toolchain**
Expand Down Expand Up @@ -895,60 +890,7 @@ It makes a warning show at the top of every page for that version.
+ --arangodb-branches << pipeline.parameters.arangodb-3_11 >> << pipeline.parameters.arangodb-3_12 >> << pipeline.parameters.arangodb-4_0 >> \
```

3. In the `toolchain/docker/amd64/docker-compose.yml` file, add an entry under
`services.toolchain.volumes` for the new version. Simply increment the value
after `:-/tmp/`. Example:

```diff
- ${ARANGODB_SRC_3_12:-/tmp/2}:/tmp/3.12
+ - ${ARANGODB_SRC_4_0:-/tmp/3}:/tmp/4.0
```

Under `services.toolchain.environment`, you need to add two different entries
for the new version. Example:

```diff
ARANGODB_SRC_3_11: ${ARANGODB_SRC_3_11}
ARANGODB_SRC_3_12: ${ARANGODB_SRC_3_12}
+ ARANGODB_SRC_4_0: ${ARANGODB_SRC_4_0}
ARANGODB_BRANCH_3_11: ${ARANGODB_BRANCH_3_11}
ARANGODB_BRANCH_3_12: ${ARANGODB_BRANCH_3_12}
+ ARANGODB_BRANCH_4_0: ${ARANGODB_BRANCH_4_0}
```

The same changes are required in the
`toolchain/docker/arm64/docker-compose.yml` file.

4. In the `toolchain/docker/config.yaml` file, add an entry for the new version.
Example:

```diff
- image: ${ARANGODB_BRANCH_3_12_IMAGE}
version: ${ARANGODB_BRANCH_3_12_VERSION}
+
+ - image: ${ARANGODB_BRANCH_4_0_IMAGE}
+ version: ${ARANGODB_BRANCH_4_0_VERSION}
```

5. In the `toolchain/scripts/toolchain.sh` file, find the code that accesses
environment variables with the format `$ARANGODB_BRANCH_X_XX` where `X_XX`
is a version number like `3_12`, so `$ARANGODB_BRANCH_3_12` for instance.
Duplicate the block of an existing version and adjust all version numbers.
Example:

```diff
if [ "$ARANGODB_BRANCH_3_12" != "" ] ; then
export ARANGODB_BRANCH_3_12_IMAGE="$ARANGODB_BRANCH_3_12"
export ARANGODB_BRANCH_3_12_VERSION="3.12"
fi

+if [ "$ARANGODB_BRANCH_4_0" != "" ] ; then
+ export ARANGODB_BRANCH_4_0_IMAGE="$ARANGODB_BRANCH_4_0"
+ export ARANGODB_BRANCH_4_0_VERSION="4.0"
+fi
```

6. In the `site/data` folder, create a new folder with the short version number
3. In the `site/data` folder, create a new folder with the short version number
as the name, e.g. `4.0`. In the new `site/data/4.0` folder, create a
`cache.json` file with the following content:

Expand All @@ -958,7 +900,7 @@ It makes a warning show at the top of every page for that version.

Add this untracked file to Git!

7. Duplicate the folder of the most recent version in `site/content`, e.g.
4. Duplicate the folder of the most recent version in `site/content`, e.g.
the `3.12` folder, and rename the copy to the new version, e.g. `4.0`.

The `menuTitle` in the front matter of the version homepage, e.g.
Expand Down Expand Up @@ -1001,7 +943,7 @@ It makes a warning show at the top of every page for that version.

Add the new, untracked files to Git!

8. In the `PULL_REQUEST_TEMPLATE.md` file, add a new line for the new version.
5. In the `PULL_REQUEST_TEMPLATE.md` file, add a new line for the new version.
Example:

```diff
Expand All @@ -1017,7 +959,7 @@ It makes a warning show at the top of every page for that version.

Expect the plain build to fail for the time being because of missing data files.

9. You can use CircleCI to initially generate the data files for the new version,
6. You can use CircleCI to initially generate the data files for the new version,
like the startup option dumps. You can also populate the example cache at the
same time.

Expand Down
3 changes: 1 addition & 2 deletions toolchain/arangoproxy/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ go 1.18
require (
github.com/dlclark/regexp2 v1.7.0
gopkg.in/yaml.v3 v3.0.1
)

)
13 changes: 3 additions & 10 deletions toolchain/docker/amd64/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,13 @@ services:
image: arangodb/docs-hugo:toolchain-amd64
tty: true
volumes:
- ${ARANGODB_SRC_3_10:-/dev/null}:/tmp/3.10
- ${ARANGODB_SRC_3_11:-/tmp/1}:/tmp/3.11
- ${ARANGODB_SRC_3_12:-/tmp/2}:/tmp/3.12
- ${ARANGODB_SRC:-/dev/null}:/tmp/arangodb_src
- /tmp/arangodb:/tmp/arangodb
- ../../../:/home/
- /var/run/docker.sock:/var/run/docker.sock
environment:
ENV: ${ENV:-local}
HUGO_URL: ${HUGO_URL:-http://localhost}
HUGO_ENV: ${HUGO_ENV:-development}
GENERATORS: ${GENERATORS}
OVERRIDE: ${OVERRIDE}
ARANGODB_SRC_3_10: ${ARANGODB_SRC_3_10}
ARANGODB_SRC_3_11: ${ARANGODB_SRC_3_11}
ARANGODB_SRC_3_12: ${ARANGODB_SRC_3_12}
ARANGODB_BRANCH_3_10: ${ARANGODB_BRANCH_3_10}
ARANGODB_BRANCH_3_11: ${ARANGODB_BRANCH_3_11}
ARANGODB_BRANCH_3_12: ${ARANGODB_BRANCH_3_12}
ARANGODB_SRC: ${ARANGODB_SRC}
13 changes: 3 additions & 10 deletions toolchain/docker/arm64/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,13 @@ services:
image: arangodb/docs-hugo:toolchain-arm64
tty: true
volumes:
- ${ARANGODB_SRC_3_10:-/dev/null}:/tmp/3.10
- ${ARANGODB_SRC_3_11:-/tmp/1}:/tmp/3.11
- ${ARANGODB_SRC_3_12:-/tmp/2}:/tmp/3.12
- ${ARANGODB_SRC:-/dev/null}:/tmp/arangodb_src
- /tmp/arangodb:/tmp/arangodb
- ../../../:/home/
- /var/run/docker.sock:/var/run/docker.sock
environment:
ENV: ${ENV:-local}
HUGO_URL: ${HUGO_URL:-http://localhost}
HUGO_ENV: ${HUGO_ENV:-development}
GENERATORS: ${GENERATORS}
OVERRIDE: ${OVERRIDE}
ARANGODB_SRC_3_10: ${ARANGODB_SRC_3_10}
ARANGODB_SRC_3_11: ${ARANGODB_SRC_3_11}
ARANGODB_SRC_3_12: ${ARANGODB_SRC_3_12}
ARANGODB_BRANCH_3_10: ${ARANGODB_BRANCH_3_10}
ARANGODB_BRANCH_3_11: ${ARANGODB_BRANCH_3_11}
ARANGODB_BRANCH_3_12: ${ARANGODB_BRANCH_3_12}
ARANGODB_SRC: ${ARANGODB_SRC}
12 changes: 2 additions & 10 deletions toolchain/docker/config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
generators: ${GENERATORS}
servers:
- image: ${ARANGODB_BRANCH_3_10_IMAGE}
version: ${ARANGODB_BRANCH_3_10_VERSION}

- image: ${ARANGODB_BRANCH_3_11_IMAGE}
version: ${ARANGODB_BRANCH_3_11_VERSION}

- image: ${ARANGODB_BRANCH_3_12_IMAGE}
version: ${ARANGODB_BRANCH_3_12_VERSION}
generators: ""
servers: ""
25 changes: 0 additions & 25 deletions toolchain/docker/docker-compose.local.yml

This file was deleted.

Loading