Drop initial code
This commit is contained in:
75
bamboo-specs/validate/docs-changesonly.yaml
Normal file
75
bamboo-specs/validate/docs-changesonly.yaml
Normal file
@@ -0,0 +1,75 @@
|
||||
tasks:
|
||||
- checkout:
|
||||
force-clean-build: 'true'
|
||||
|
||||
- script: |
|
||||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
|
||||
# Ensure there's at least one previous commit
|
||||
if git rev-parse HEAD~1 >/dev/null 2>&1; then
|
||||
# Collect changed *.md files under docs/ (ignore deletions)
|
||||
CHANGED_MD_FILES=$(git diff --name-status HEAD~1 HEAD | \
|
||||
awk '$1 != "D" {print $2}' | grep '^docs/.*\.md$' || true)
|
||||
else
|
||||
echo "No previous commit to compare against. Skipping update."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ -z "${CHANGED_MD_FILES}" ]]; then
|
||||
echo "No relevant markdown files changed under docs/. Skipping Confluence update."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Parse minor version from semantic version
|
||||
MINOR_VERSION=$(echo "${bamboo.inject.gtag}" | grep -Eo "^[0-9]+\.[0-9]+")
|
||||
|
||||
# Inject version numbers into documentation
|
||||
sed -i "s/{{ release_version }}/${bamboo.inject.gtag}/g;s/{{ minor_version }}/${MINOR_VERSION}/g" README.md
|
||||
sed -i "s/{{ release_version }}/${bamboo.inject.gtag}/g;s/{{ minor_version }}/${MINOR_VERSION}/g" docs/*.md
|
||||
|
||||
# Create temporary folder
|
||||
mkdir -p ./vi_certs
|
||||
|
||||
# Download latest Vanderlande CA certificates
|
||||
curl https://pki.vanderlande.com/pki/VanderlandeRootCA.crt -o - | \
|
||||
openssl x509 -inform DER -out ./vi_certs/VanderlandeRootCA.crt
|
||||
curl https://pki.vanderlande.com/pki/VanderlandeSubordinateCA-Internal.crt \
|
||||
-o ./vi_certs/VanderlandeSubordinateCA-Internal.crt
|
||||
|
||||
echo "---"
|
||||
echo "Starting Confluence update for the following files:"
|
||||
echo "${CHANGED_MD_FILES}"
|
||||
echo "---"
|
||||
|
||||
# Since -f only accepts one file, we must loop through the list of changed files.
|
||||
for file in ${CHANGED_MD_FILES}
|
||||
do
|
||||
echo "Processing file: ${file}"
|
||||
|
||||
# Run a separate docker command for each file
|
||||
docker run --rm --name "confluence-docs-update" \
|
||||
-v "${bamboo.hostvolume}:/code" \
|
||||
-v "${bamboo.hostvolume}/vi_certs:/usr/local/share/ca-certificates" \
|
||||
-w /code \
|
||||
"${bamboo.container_mark}" \
|
||||
/bin/bash -c "\
|
||||
update-ca-certificates && \
|
||||
mark -u '${bamboo.confluence_username}' \
|
||||
-p '${bamboo.confluence_password}' \
|
||||
-b '${bamboo.confluence_url}' \
|
||||
--ci --changes-only \
|
||||
--title-from-h1 \
|
||||
--space ${bamboo.confluence_space} \
|
||||
--parents 'IT Technology Platform/Team Devcolla'\''s/Application Stack/Harvester Cloud Native Virtualization' \
|
||||
-f '${file}'"
|
||||
echo "Finished processing ${file}."
|
||||
echo "---"
|
||||
done
|
||||
|
||||
other:
|
||||
clean-working-dir: true
|
||||
|
||||
requirements:
|
||||
- system.docker.executable
|
||||
- AGENT_TYPE: Linux_Base_Agent
|
||||
Reference in New Issue
Block a user