Using gitlab api to upload wiki page (14.9)
when uploading a wiki page using the gitlab api, yaml meta data reference is striped out. Is this expected behaviour ?
bash function to upload a standard page to every project wiki.
gitlab-wiki-runbook ()
{
# Add a RunBook.md to all project wikis
set-Gitlab-access-token
# Get the GitLab API URL
local API_URL="${CI_API_V4_URL:-https://my-gitlab.con/api/v4}"
# Set variables
local GITLAB_API_TOKEN="${GITLAB_TOKEN}"
local PROJECT_IDS=()
# Get list of GitLab projects
local PROJECT_LIST_JSON=$(gitlab_projects_list_simple)
# read each item in the JSON array to an item in the Bash array
readarray -t PROJECT_LIST < <(jq -c '.[]' <<< ${PROJECT_LIST_JSON})
# Add RunBook wiki page
for PROJECT in "${PROJECT_LIST[@]}"; do
# echo ${PROJECT}
# Extract project ID
PROJECT_ID=$(echo "$PROJECT" | jq -r '.id')
REPO=$(echo "$PROJECT" | jq -r '.path')
NAME=$(echo "$PROJECT" | jq -r '.name')
CONTENT="---
tags: ${REPO}, wiki, RunBook
alias: ${REPO}-wiki-RunBook, ${NAME} Run Book
---
# ${NAME} Run Book
"
echo ${CONTENT}
curl \
--data-urlencode "format=markdown" \
--data-urlencode "title=RunBook" \
--data-urlencode "content=${CONTENT}" \
--silent \
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
"${API_URL}/projects/${PROJECT_ID}/wikis"
done
}
tried with curl and wget same resilt every thing between — and — get remove.
play around with – or – - work as expected but not loading wiki meta data.
As asked is this expected behaviour ? before i create a work round.