diff --git a/.github/workflows/auto-update-documentation.yml b/.github/workflows/auto-update-documentation.yml new file mode 100644 index 0000000000..dd5da60961 --- /dev/null +++ b/.github/workflows/auto-update-documentation.yml @@ -0,0 +1,107 @@ +name: Autoupdate Documentation +# +# Takes care of updating the Vespa documentation. +# + +on: + workflow_dispatch: # Allow manual triggering of the workflow + + schedule: + - cron: "0 0 * * *" + + repository_dispatch: + types: + - update-vespa-version + - update-vespa-cli-doc + +permissions: + contents: write + pull-requests: write + +defaults: + run: + # This ensures that options "pipefail" and "errexit" are set for all steps. + # Ref: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#defaultsrunshell + shell: bash + +jobs: + update-vespa-version: + # + # This job updates the Vespa version in the documentation. + # + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@v4 + + - name: Setup Dependencies + run: | + sudo apt-get update + sudo apt-get install -y xq + + - name: Get Latest Vespa version + run: | + VESPA_VERSION=$(curl -sSL https://repo1.maven.org/maven2/com/yahoo/vespa/parent/maven-metadata.xml | \ + xq -x '/metadata/versioning/latest') + + echo "Vespa version: $VESPA_VERSION" + + sed -i'' "s/\(vespa_version:\) \"[0-9\.]*\"/\1 \"${VESPA_VERSION}\"/" _config.yml + git diff + + # Check if there are changes to commit. + if [[ -n "$(git status --porcelain)" ]]; then + echo "Updating Vespa version in documentation to ${VESPA_VERSION}" >> $GITHUB_STEP_SUMMARY + git config --global user.email "bot+actions@vespa.ai" + git config --global user.name "${{ github.actor}}" + git commit -m "Update Vespa-version to ${VESPA_VERSION} - MERGEOK" _config.yml + git pull --rebase + git push + fi + + update-vespa-cli-doc: + # + # This job updates the Vespa CLI documentation. + # + runs-on: ubuntu-latest + + env: + VESPA_CLI_DOC_DIR: en/reference/vespa-cli + + steps: + - uses: actions/checkout@v4 + + - name: Install Vespa CLI + uses: vespa-engine/setup-vespa-cli-action@v1 + + - name: Generate Vespa CLI Documentation + working-directory: ${{ env.VESPA_CLI_DOC_DIR }} + run: | + vespa gendoc . + + for f in $(git status --short . | awk '{print $2}'); do + title=${f//.md/} + title=${title//.\//} + title=${title//_/ } + (echo -e "---\ntitle: $title\nrender_with_liquid: false\n---\n"; cat ${f}) > ${f}.new + mv ${f}.new ${f}; + done + + # ensure linka are to .html + sed -i'' 's/\(vespa.*\).md)/\1.html)/' *.md + # create links + sed -i'' 's#\(https://[a-z.]*vespa.ai/[^[:space:]]*\)#[\1](\1)#g' *.md + + git diff + + # Check if there are changes to commit. + if [[ -n "$(git status --porcelain)" ]]; then + echo "Updating Vespa CLI reference documentation" >> $GITHUB_STEP_SUMMARY + git config --global user.email "bot+actions@vespa.ai" + git config --global user.name "${{ github.actor}}" + + git add vespa*.md + git commit -m "Update Vespa-CLI reference doc MERGEOK" + git pull --rebase + git push + fi diff --git a/.github/workflows/auto-update-versions.yml b/.github/workflows/auto-update-versions.yml deleted file mode 100644 index 3fdf9d26e9..0000000000 --- a/.github/workflows/auto-update-versions.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Auto-update versions -# -# Takes care of updating the Vespa version in the documentation. -# - -on: - workflow_dispatch: # Allow manual triggering of the workflow - - schedule: - - cron: "0 0 * * *" - - repository_dispatch: - types: [update-vespa-version] - - # For testing purposes - push: - branches: [auto-update-versions] - -permissions: - contents: write - pull-requests: write - -defaults: - run: - # This ensures that options "pipefail" and "errexit" are set for all steps. - # Ref: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#defaultsrunshell - shell: bash - -jobs: - update-vespa-version: - runs-on: ubuntu-24.04 - - steps: - - uses: actions/checkout@v4 - - - name: Setup Dependencies - run: | - sudo apt-get update - sudo apt-get install -y xq - - - name: Get Latest Vespa version - run: | - VESPA_VERSION=$(curl -sSL https://repo1.maven.org/maven2/com/yahoo/vespa/parent/maven-metadata.xml | \ - xq -x '/metadata/versioning/latest') - - echo "Vespa version: $VESPA_VERSION" - - sed -i'' "s/\(vespa_version:\) \"[0-9\.]*\"/\1 \"${VESPA_VERSION}\"/" _config.yml - git diff - - # Check if there are changes to commit. - if [[ -n "$(git status --porcelain)" ]]; then - echo "Updating Vespa version in documentation to ${VESPA_VERSION}" >> $GITHUB_STEP_SUMMARY - git config --global user.email "bot+actions@vespa.ai" - git config --global user.name "${{ github.actor}}" - git commit -m "Update Vespa-version to ${VESPA_VERSION} - MERGEOK" _config.yml - git pull --rebase - git push - fi diff --git a/_config.yml b/_config.yml index 2f27f639b7..7107586c4b 100644 --- a/_config.yml +++ b/_config.yml @@ -55,7 +55,7 @@ exclude: search: namespace: "open" doc_type: "doc" - do_feed: true + do_feed : true do_index_removal_before_feed: false feed_endpoints: - url: https://vespacloud-docsearch.vespa-team.aws-us-east-1c.z.vespa-app.cloud/ @@ -75,11 +75,12 @@ search: - open_index.json defaults: - - scope: - path: "" + - + scope: + path : "" values: layout: "default" - index: true + index : true variables: - vespa_version: "123" + vespa_version: "8.388.11" diff --git a/screwdriver.yaml b/screwdriver.yaml index 885244e741..f356c5cc87 100644 --- a/screwdriver.yaml +++ b/screwdriver.yaml @@ -61,86 +61,86 @@ jobs: # cd $SD_DIND_SHARE_PATH # $SD_SOURCE_DIR/test/test.py -c $SD_SOURCE_DIR/test/_test_config-large.yml -w $SD_SOURCE_DIR - update-vespa-version: - image: buildpack-deps - annotations: - screwdriver.cd/buildPeriodically: H H(0-5) * * 1 # some time between 12:00 AM UTC (midnight) to 5:59 AM UTC Mon - secrets: - - VESPA_DOC_DEPLOY_KEY - environment: - GIT_SSH_COMMAND: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" - steps: - - update-to-latest: | - # must checkout the repo again using ssh for the credentials to work - cat << EOF > pushtogit.sh - #!/bin/bash - ssh-add -D - set +x - ssh-add <(echo \$VESPA_DOC_DEPLOY_KEY | base64 -d) - set -x - git clone git@github.com:vespa-engine/documentation.git documentation && cd documentation - VESPA_VERSION=\$(curl -sSL https://repo1.maven.org/maven2/com/yahoo/vespa/parent/maven-metadata.xml | \ - grep -oP '\K([0-9]+\.[0-9]+\.[0-9]+)') - echo "Latest Vespa version is: " \${VESPA_VERSION} - sed -i.orig "s/vespa_version: \"[0-9\.]*\"/vespa_version: \"\${VESPA_VERSION}\"/" _config.yml - git diff - changes=\$(git status --porcelain | wc -l) - if (( changes > 0 )); then - echo "Updating Vespa version in documentation to \${VESPA_VERSION}" - git commit -m "Update Vespa-version to \${VESPA_VERSION} MERGEOK" _config.yml - git pull --rebase - git push - fi - EOF - /usr/bin/ssh-agent /bin/bash pushtogit.sh + # update-vespa-version: + # image: buildpack-deps + # annotations: + # screwdriver.cd/buildPeriodically: H H(0-5) * * 1 # some time between 12:00 AM UTC (midnight) to 5:59 AM UTC Mon + # secrets: + # - VESPA_DOC_DEPLOY_KEY + # environment: + # GIT_SSH_COMMAND: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" + # steps: + # - update-to-latest: | + # # must checkout the repo again using ssh for the credentials to work + # cat << EOF > pushtogit.sh + # #!/bin/bash + # ssh-add -D + # set +x + # ssh-add <(echo \$VESPA_DOC_DEPLOY_KEY | base64 -d) + # set -x + # git clone git@github.com:vespa-engine/documentation.git documentation && cd documentation + # VESPA_VERSION=\$(curl -sSL https://repo1.maven.org/maven2/com/yahoo/vespa/parent/maven-metadata.xml | \ + # grep -oP '\K([0-9]+\.[0-9]+\.[0-9]+)') + # echo "Latest Vespa version is: " \${VESPA_VERSION} + # sed -i.orig "s/vespa_version: \"[0-9\.]*\"/vespa_version: \"\${VESPA_VERSION}\"/" _config.yml + # git diff + # changes=\$(git status --porcelain | wc -l) + # if (( changes > 0 )); then + # echo "Updating Vespa version in documentation to \${VESPA_VERSION}" + # git commit -m "Update Vespa-version to \${VESPA_VERSION} MERGEOK" _config.yml + # git pull --rebase + # git push + # fi + # EOF + # /usr/bin/ssh-agent /bin/bash pushtogit.sh - update-vespa-cli-doc: - image: buildpack-deps - annotations: - screwdriver.cd/buildPeriodically: H H(0-5) * * 1 # some time between 12:00 AM UTC (midnight) to 5:59 AM UTC Mon - secrets: - - VESPA_DOC_DEPLOY_KEY - environment: - GIT_SSH_COMMAND: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" - steps: - - get-vespa-cli: | - VESPA_CLI_VERSION=$(curl -fsSL https://api.github.com/repos/vespa-engine/vespa/releases/latest | grep -Po '"tag_name": "v\K.*?(?=")') && \ - curl -fsSL https://github.com/vespa-engine/vespa/releases/download/v${VESPA_CLI_VERSION}/vespa-cli_${VESPA_CLI_VERSION}_linux_amd64.tar.gz | tar -zxf - -C /opt && \ - ln -sf /opt/vespa-cli_${VESPA_CLI_VERSION}_linux_amd64/bin/vespa /usr/local/bin/ - - check-and-update: | - # must checkout the repo again using ssh for the credentials to work - cat << EOF > pushtogit.sh - #!/bin/bash - ssh-add -D - set +x - ssh-add <(echo \$VESPA_DOC_DEPLOY_KEY | base64 -d) - set -x - git clone git@github.com:vespa-engine/documentation.git documentation - cd documentation/en/reference/vespa-cli - vespa gendoc . - find . -name \*.md | \ - while read f; do \ - title=\${f//.md/}; \ - title=\${title//.\//}; \ - title=\${title//_/ }; \ - (echo -e "---\ntitle: \$title\nrender_with_liquid: false\n---\n"; cat \${f})>\${f}.new; \ - mv \${f}.new \${f}; \ - done - # link to .html - sed -i.orig 's/\(vespa.*\).md)/\1.html)/' *.md - # create links - sed -i.orig 's#\(https://[a-z.]*vespa.ai/[^[:space:]]*\)#[\1](\1)#g' *.md - rm *.orig - git diff - changes=\$(git status --porcelain | wc -l) - if (( changes > 0 )); then - echo "Updating Vespa CLI reference documentation" - git commit -m "Update Vespa-CLI reference doc MERGEOK" vespa*.md - git pull --rebase - git push - fi - EOF - /usr/bin/ssh-agent /bin/bash pushtogit.sh + # update-vespa-cli-doc: + # image: buildpack-deps + # annotations: + # screwdriver.cd/buildPeriodically: H H(0-5) * * 1 # some time between 12:00 AM UTC (midnight) to 5:59 AM UTC Mon + # secrets: + # - VESPA_DOC_DEPLOY_KEY + # environment: + # GIT_SSH_COMMAND: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" + # steps: + # - get-vespa-cli: | + # VESPA_CLI_VERSION=$(curl -fsSL https://api.github.com/repos/vespa-engine/vespa/releases/latest | grep -Po '"tag_name": "v\K.*?(?=")') && \ + # curl -fsSL https://github.com/vespa-engine/vespa/releases/download/v${VESPA_CLI_VERSION}/vespa-cli_${VESPA_CLI_VERSION}_linux_amd64.tar.gz | tar -zxf - -C /opt && \ + # ln -sf /opt/vespa-cli_${VESPA_CLI_VERSION}_linux_amd64/bin/vespa /usr/local/bin/ + # - check-and-update: | + # # must checkout the repo again using ssh for the credentials to work + # cat << EOF > pushtogit.sh + # #!/bin/bash + # ssh-add -D + # set +x + # ssh-add <(echo \$VESPA_DOC_DEPLOY_KEY | base64 -d) + # set -x + # git clone git@github.com:vespa-engine/documentation.git documentation + # cd documentation/en/reference/vespa-cli + # vespa gendoc . + # find . -name \*.md | \ + # while read f; do \ + # title=\${f//.md/}; \ + # title=\${title//.\//}; \ + # title=\${title//_/ }; \ + # (echo -e "---\ntitle: \$title\nrender_with_liquid: false\n---\n"; cat \${f})>\${f}.new; \ + # mv \${f}.new \${f}; \ + # done + # # link to .html + # sed -i.orig 's/\(vespa.*\).md)/\1.html)/' *.md + # # create links + # sed -i.orig 's#\(https://[a-z.]*vespa.ai/[^[:space:]]*\)#[\1](\1)#g' *.md + # rm *.orig + # git diff + # changes=\$(git status --porcelain | wc -l) + # if (( changes > 0 )); then + # echo "Updating Vespa CLI reference documentation" + # git commit -m "Update Vespa-CLI reference doc MERGEOK" vespa*.md + # git pull --rebase + # git push + # fi + # EOF + # /usr/bin/ssh-agent /bin/bash pushtogit.sh generate-metric-reference: image: buildpack-deps