Drop initial code
This commit is contained in:
99
bamboo-specs/bamboo.yaml
Normal file
99
bamboo-specs/bamboo.yaml
Normal file
@@ -0,0 +1,99 @@
|
||||
---
|
||||
version: 2
|
||||
## Plan properties
|
||||
plan:
|
||||
project-key: ITTP
|
||||
key: ASVICNV
|
||||
name: AS-VI-Cloud Native Virtualization
|
||||
|
||||
branches:
|
||||
delete:
|
||||
after-deleted-days: 2
|
||||
after-inactive-days: never
|
||||
|
||||
other:
|
||||
concurrent-build-plugin: 5
|
||||
all-other-apps:
|
||||
buildExpiryConfig:
|
||||
duration: 5
|
||||
enabled: true
|
||||
expiryTypeResult: true
|
||||
maximumBuildsToKeep: 5
|
||||
period: days
|
||||
|
||||
## variables used in the jobs
|
||||
variables:
|
||||
## OVA build variables
|
||||
hostvolume: /data/bamboo/${bamboo.capability.AGENT_ID}/xml-data/build-dir/${bamboo.buildKey}
|
||||
containerregistry_release: devstore.vanderlande.com:6555
|
||||
containerregistry_virtual: devstore.vanderlande.com:6559
|
||||
container_agent: ${bamboo.containerregistry_release}/com/vanderlande/conpl/bamboo-agent-extended:1.5.0-linuxbase
|
||||
container_semrel: ${bamboo.containerregistry_virtual}/com/vanderlande/conpl/bamboo-semantic-release:v23.0.2
|
||||
container_mark: kovetskiy/mark:12.2.0
|
||||
## SemRel variables
|
||||
httpsaccesskey_secret: BAMSCRT@0@0@FyHDe+gBcijblOU8jpGcEEwxpYBWQ0cl2NxEgACy5MidjyRlcZKAS4YXC/nLS8sOXZKHKBF3Siyeh2fdnAjOeg==
|
||||
## confluence documentation patch
|
||||
confluence_url: https://devcolla.vanderlande.com
|
||||
confluence_username: srv.conpldocs
|
||||
confluence_password: BAMSCRT@0@0@UxPtDd1NpJ/YoYuImly6ZLqS62SCxPQK5uonPqkfF94=
|
||||
confluence_space: ITTP
|
||||
|
||||
|
||||
stages:
|
||||
- Prepare:
|
||||
- import-variables
|
||||
- semantic-release-dryrun
|
||||
- Validate:
|
||||
- docs-dryrun
|
||||
- Documentation:
|
||||
- docs-changesonly
|
||||
|
||||
import-variables: !include "prepare/import-variables.yaml"
|
||||
semantic-release-dryrun: !include "prepare/semantic-release-dryrun.yaml"
|
||||
docs-dryrun: !include "validate/docs-dryrun.yaml"
|
||||
docs-changesonly: !include "validate/docs-changesonly.yaml"
|
||||
|
||||
branch-overrides:
|
||||
- docs-.*:
|
||||
stages:
|
||||
- Prepare:
|
||||
- import-variables
|
||||
- Documentation:
|
||||
- docs-dryrun
|
||||
- docs-changesonly
|
||||
docs-changesonly: !include "validate/docs-changesonly.yaml"
|
||||
import-variables: !include "prepare/import-variables.yaml"
|
||||
docs-dryrun: !include "validate/docs-dryrun.yaml"
|
||||
|
||||
- development:
|
||||
stages:
|
||||
- Prepare:
|
||||
- import-variables
|
||||
- semantic-release-dryrun
|
||||
- Validate:
|
||||
- docs-dryrun
|
||||
- Release:
|
||||
- semantic-release
|
||||
- Documentation:
|
||||
- docs-changesonly
|
||||
import-variables: !include "prepare/import-variables.yaml"
|
||||
semantic-release-dryrun: !include "prepare/semantic-release-dryrun.yaml"
|
||||
docs-dryrun: !include "validate/docs-dryrun.yaml"
|
||||
docs-changesonly: !include "validate/docs-changesonly.yaml"
|
||||
semantic-release: !include "release/semantic-release.yaml"
|
||||
|
||||
- main|^.*.x:
|
||||
stages:
|
||||
- Prepare:
|
||||
- import-variables
|
||||
- semantic-release-dryrun
|
||||
- Release:
|
||||
- semantic-release
|
||||
- Documentation:
|
||||
- docs
|
||||
import-variables: !include "prepare/import-variables.yaml"
|
||||
semantic-release-dryrun: !include "prepare/semantic-release-dryrun.yaml"
|
||||
docs: !include "validate/docs.yaml"
|
||||
semantic-release: !include "release/semantic-release.yaml"
|
||||
|
||||
|
||||
40
bamboo-specs/prepare/import-variables.yaml
Normal file
40
bamboo-specs/prepare/import-variables.yaml
Normal file
@@ -0,0 +1,40 @@
|
||||
tasks:
|
||||
- script: |
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
case ${bamboo_planRepository_branch} in
|
||||
main)
|
||||
USER=${bamboo.release_deployer_username}
|
||||
PASSWORD=${bamboo.release_deployer_password}
|
||||
REPOSITORY="nlveg-gen-release-local-01"
|
||||
;;
|
||||
*.x)
|
||||
USER=${bamboo.release_deployer_username}
|
||||
PASSWORD=${bamboo.release_deployer_password}
|
||||
REPOSITORY="nlveg-gen-release-local-01"
|
||||
;;
|
||||
|
||||
*)
|
||||
USER=${bamboo.snapshot_deployer_username}
|
||||
PASSWORD=${bamboo.snapshot_deployer_password}
|
||||
REPOSITORY="nlveg-gen-devteam-local-01"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# Inject custom variables into inject-variables source file (inception)
|
||||
# (Bamboo does not allow proper variable substition operations)
|
||||
echo -e "\nvmname=conpl_${bamboo.buildNumber}_$(date +"%m-%d-%Y")_$(echo "${bamboo.planRepository.revision}" | head -c7 -z)" >> pipeline.parameters
|
||||
echo "artifactory_username=${USER}" >> pipeline.parameters
|
||||
echo "artifactory_password=${PASSWORD}" >> pipeline.parameters
|
||||
echo "artifactory_repository=${REPOSITORY}" >> pipeline.parameters
|
||||
echo "var_file=${VAR_FILE}" >> pipeline.parameters
|
||||
|
||||
- inject-variables:
|
||||
file: pipeline.parameters
|
||||
scope: RESULT
|
||||
other:
|
||||
clean-working-dir: true
|
||||
requirements:
|
||||
- AGENT_TYPE: Linux_Base_Agent
|
||||
55
bamboo-specs/prepare/semantic-release-dryrun.yaml
Normal file
55
bamboo-specs/prepare/semantic-release-dryrun.yaml
Normal file
@@ -0,0 +1,55 @@
|
||||
tasks:
|
||||
- checkout:
|
||||
force-clean-build: 'true'
|
||||
- script: |
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
docker run --rm --user 555:555 -v ${bamboo.hostvolume}:/code -w /code \
|
||||
${bamboo.container_semrel} \
|
||||
npx semantic-release \
|
||||
--dry-run --repository-url https://${bamboo.httpsaccesskey_secret}@devstash.vanderlande.com/scm/ittp/as-vi-cnv.git \
|
||||
--verifyRelease @semantic-release/exec \
|
||||
--verifyReleaseCmd 'echo "${nextRelease.version}" > .version'
|
||||
|
||||
# Function to determine the version tag
|
||||
get_version_tag() {
|
||||
if [ -f .version ]; then
|
||||
echo "$(cat .version)"
|
||||
else
|
||||
echo "$(git describe --abbrev=0 --tags | awk '{gsub("^v", ""); print}')"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to determine the commit hash
|
||||
get_commit_hash() {
|
||||
echo "$(git log -1 --pretty=format:%h)"
|
||||
}
|
||||
|
||||
# Get version tag and commit hash
|
||||
version_tag=$(get_version_tag)
|
||||
commit_hash=$(get_commit_hash)
|
||||
override=$(git log -1 --pretty=format:%s | grep -oP '\[docs-override v\K[^\]]+') || true
|
||||
|
||||
# Determine gtag and template_suffix based on branch
|
||||
if [[ "${bamboo_planRepository_branch}" == "main" || "${bamboo_planRepository_branch}" =~ ^[0-9]+\.[0-9]+\.x$ ]]; then
|
||||
template_suffix="${version_tag}"
|
||||
elif [[ "${bamboo_planRepository_branch}" == docs-* && -n $override ]]; then
|
||||
version_tag="${override}"
|
||||
template_suffix="${override}"
|
||||
else
|
||||
template_suffix="${version_tag}-${commit_hash}"
|
||||
fi
|
||||
|
||||
# Write to pipeline.parameters
|
||||
echo -e "\ngtag=${version_tag}" >> pipeline.parameters
|
||||
echo -e "\ntemplate_suffix=${template_suffix}" >> pipeline.parameters
|
||||
|
||||
- inject-variables:
|
||||
file: pipeline.parameters
|
||||
scope: RESULT
|
||||
other:
|
||||
clean-working-dir: true
|
||||
requirements:
|
||||
- system.docker.executable
|
||||
- AGENT_TYPE: Linux_Base_Agent
|
||||
14
bamboo-specs/release/semantic-release.yaml
Normal file
14
bamboo-specs/release/semantic-release.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
tasks:
|
||||
- checkout:
|
||||
force-clean-build: 'true'
|
||||
- script: |
|
||||
set -x
|
||||
docker run --rm --user 555:555 -v ${bamboo.hostvolume}:/code -w /code \
|
||||
${bamboo.container_semrel} \
|
||||
npx semantic-release \
|
||||
--repository-url https://${bamboo.httpsaccesskey_secret}@devstash.vanderlande.com/scm/ittp/as-vi-cnv.git
|
||||
other:
|
||||
clean-working-dir: true
|
||||
requirements:
|
||||
- system.docker.executable
|
||||
- AGENT_TYPE: Linux_Base_Agent
|
||||
22
bamboo-specs/validate/ansible-lint.yaml
Normal file
22
bamboo-specs/validate/ansible-lint.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
## Molecule deploy and test
|
||||
tasks:
|
||||
- script: |
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
|
||||
# Run ansible-lint for the first set of roles (cp/lifecycle)
|
||||
if ! docker run --rm --volume ${bamboo.hostvolume}:/data \
|
||||
--workdir=/data \
|
||||
${bamboo.container_molecule} \
|
||||
ansible-lint -c .ansible-lint.yml; then
|
||||
echo "ERROR: Ansible Lint failed. Check the output for details."
|
||||
exit 1 # Stop the script immediately
|
||||
fi
|
||||
echo "Ansible Lint successful for all ansible/collections/ansible_collections!"
|
||||
other:
|
||||
clean-working-dir: true
|
||||
requirements:
|
||||
- system.docker.executable
|
||||
- AGENT_TYPE: Linux_Base_Agent
|
||||
10
bamboo-specs/validate/artifactory-ping.yaml
Normal file
10
bamboo-specs/validate/artifactory-ping.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
tasks:
|
||||
- script: |
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
docker run --rm ${bamboo.container_jfrog} jfrog rt ping --user ${bamboo.snapshot_deployer_username} --password ${bamboo.snapshot_deployer_password} --url https://devstore.vanderlande.com/artifactory
|
||||
other:
|
||||
clean-working-dir: true
|
||||
requirements:
|
||||
- AGENT_TYPE: Linux_Base_Agent
|
||||
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
|
||||
63
bamboo-specs/validate/docs-dryrun.yaml
Normal file
63
bamboo-specs/validate/docs-dryrun.yaml
Normal file
@@ -0,0 +1,63 @@
|
||||
tasks:
|
||||
- checkout:
|
||||
force-clean-build: 'true'
|
||||
- script: |
|
||||
#!/bin/bash
|
||||
set -x
|
||||
|
||||
# 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 certificate authority 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
|
||||
|
||||
# Update README markdown 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}' \
|
||||
--title-from-h1 \
|
||||
--space ${bamboo.confluence_space} \
|
||||
--parents 'IT Technology Platform/Team Devcolla'\''s/Application Stack/Harvester Cloud Native Virtualization' \
|
||||
--dry-run \
|
||||
-f './README.md' || exit 1"
|
||||
|
||||
# Update all markdown files in docs/
|
||||
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' \
|
||||
--dry-run \
|
||||
-f './docs/*.md' || exit 1"
|
||||
|
||||
other:
|
||||
clean-working-dir: true
|
||||
requirements:
|
||||
- system.docker.executable
|
||||
- AGENT_TYPE: Linux_Base_Agent
|
||||
61
bamboo-specs/validate/docs.yaml
Normal file
61
bamboo-specs/validate/docs.yaml
Normal file
@@ -0,0 +1,61 @@
|
||||
tasks:
|
||||
- checkout:
|
||||
force-clean-build: 'true'
|
||||
- script: |
|
||||
#!/bin/bash
|
||||
set -x
|
||||
|
||||
# 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 certificate authority 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
|
||||
|
||||
# Update README markdown 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}' \
|
||||
--title-from-h1 \
|
||||
--space ${bamboo.confluence_space} \
|
||||
--parents 'IT Technology Platform/Team Devcolla'\''s/Application Stack/Harvester Cloud Native Virtualization' \
|
||||
-f './README.md' || exit 1"
|
||||
|
||||
# Update all markdown files in docs/
|
||||
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 './docs/*.md' || exit 1"
|
||||
|
||||
other:
|
||||
clean-working-dir: true
|
||||
requirements:
|
||||
- system.docker.executable
|
||||
- AGENT_TYPE: Linux_Base_Agent
|
||||
Reference in New Issue
Block a user