2021-01-24 08:26:53 +00:00
|
|
|
kind: pipeline
|
|
|
|
type: kubernetes
|
|
|
|
name: 'Packer Build'
|
2023-01-18 14:09:32 +00:00
|
|
|
|
2021-04-10 13:32:31 +00:00
|
|
|
volumes:
|
|
|
|
- name: output
|
|
|
|
claim:
|
|
|
|
name: flexvolsmb-drone-output
|
|
|
|
- name: scratch
|
|
|
|
claim:
|
|
|
|
name: flexvolsmb-drone-scratch
|
2021-01-24 08:26:53 +00:00
|
|
|
|
2023-05-21 16:09:22 +00:00
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
exclude:
|
|
|
|
- tag
|
|
|
|
|
2021-01-24 08:26:53 +00:00
|
|
|
steps:
|
2021-06-05 17:34:31 +00:00
|
|
|
- name: Debugging information
|
|
|
|
image: bv11-cr01.bessems.eu/library/packer-extended
|
2023-04-03 14:26:38 +00:00
|
|
|
pull: always
|
2021-06-05 17:34:31 +00:00
|
|
|
commands:
|
2021-06-07 11:19:00 +00:00
|
|
|
- ansible --version
|
2021-06-05 17:34:31 +00:00
|
|
|
- ovftool --version
|
2022-06-27 07:54:57 +00:00
|
|
|
- packer --version
|
|
|
|
- yamllint --version
|
2023-04-03 13:43:10 +00:00
|
|
|
|
2023-04-03 14:26:38 +00:00
|
|
|
- name: Linting
|
2023-04-03 14:32:05 +00:00
|
|
|
depends_on:
|
|
|
|
- Debugging information
|
2023-04-03 14:26:38 +00:00
|
|
|
image: bv11-cr01.bessems.eu/library/packer-extended
|
|
|
|
pull: always
|
|
|
|
commands:
|
|
|
|
- |
|
|
|
|
yamllint -d "{extends: relaxed, rules: {line-length: disable}}" \
|
|
|
|
ansible \
|
|
|
|
packer/preseed/UbuntuServer22.04/user-data \
|
|
|
|
scripts
|
|
|
|
|
2023-05-20 10:44:32 +00:00
|
|
|
- name: Semantic Release (Dry-run)
|
2023-04-03 14:32:05 +00:00
|
|
|
depends_on:
|
|
|
|
- Linting
|
2023-05-20 10:44:32 +00:00
|
|
|
image: bv11-cr01.bessems.eu/proxy/library/node:20-slim
|
|
|
|
pull: always
|
|
|
|
commands:
|
2023-05-20 10:48:40 +00:00
|
|
|
- |
|
|
|
|
apt-get update
|
|
|
|
- |
|
|
|
|
apt-get install -y --no-install-recommends \
|
|
|
|
git-core \
|
|
|
|
ca-certificates
|
2023-05-20 10:44:32 +00:00
|
|
|
- |
|
2023-05-20 11:44:54 +00:00
|
|
|
npm install \
|
2023-05-20 12:32:47 +00:00
|
|
|
semantic-release \
|
|
|
|
@semantic-release/commit-analyzer \
|
2023-05-22 07:09:50 +00:00
|
|
|
@semantic-release/exec \
|
2023-05-20 11:22:20 +00:00
|
|
|
- |
|
2023-05-20 11:26:49 +00:00
|
|
|
export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY}
|
2023-05-20 10:44:32 +00:00
|
|
|
- |
|
2023-05-20 10:58:44 +00:00
|
|
|
npx semantic-release \
|
2023-05-22 07:23:44 +00:00
|
|
|
--package @semantic-release/exec \
|
|
|
|
--package semantic-release \
|
2023-05-21 16:09:22 +00:00
|
|
|
--branches ${DRONE_BRANCH} \
|
2023-06-20 13:44:45 +00:00
|
|
|
--tag-format K8s_1.25.9-v$${version} \
|
2023-05-22 07:23:44 +00:00
|
|
|
--dry-run \
|
|
|
|
--plugins @semantic-release/commit-analyzer,@semantic-release/exec \
|
|
|
|
--analyzeCommits @semantic-release/commit-analyzer \
|
|
|
|
--verifyRelease @semantic-release/exec \
|
2023-05-22 10:11:14 +00:00
|
|
|
--verifyReleaseCmd 'echo "$${nextRelease.version}" > .version'
|
2023-05-20 11:22:20 +00:00
|
|
|
environment:
|
|
|
|
GIT_APIKEY:
|
|
|
|
from_secret: git_apikey
|
|
|
|
GIT_USERNAME: djpbessems
|
2023-05-20 10:44:32 +00:00
|
|
|
|
2023-05-22 10:19:10 +00:00
|
|
|
- name: Install Ansible Galaxy collections
|
2023-05-22 10:06:14 +00:00
|
|
|
depends_on:
|
|
|
|
- Semantic Release (Dry-run)
|
2023-05-22 07:23:44 +00:00
|
|
|
image: bv11-cr01.bessems.eu/library/packer-extended
|
|
|
|
pull: always
|
|
|
|
commands:
|
|
|
|
- |
|
2023-05-22 10:19:10 +00:00
|
|
|
ansible-galaxy collection install \
|
|
|
|
-r ansible/requirements.yml \
|
|
|
|
-p ./ansible/collections
|
2023-04-03 14:26:38 +00:00
|
|
|
|
2023-05-22 10:19:10 +00:00
|
|
|
- name: Kubernetes Bootstrap Appliance
|
|
|
|
depends_on:
|
|
|
|
- Install Ansible Galaxy collections
|
|
|
|
image: bv11-cr01.bessems.eu/library/packer-extended
|
|
|
|
pull: always
|
|
|
|
commands:
|
|
|
|
- |
|
|
|
|
sed -i -e "s/<<img-password>>/$${SSH_PASSWORD}/g" \
|
|
|
|
packer/preseed/UbuntuServer22.04/user-data
|
|
|
|
- |
|
|
|
|
export K8S_VERSION=$(yq '.components.clusterapi.workload.version.k8s' < ./ansible/vars/metacluster.yml)
|
|
|
|
export NEXT_RELEASE_VERSION=$(cat .version)
|
|
|
|
- |
|
|
|
|
packer init -upgrade \
|
|
|
|
./packer
|
|
|
|
- |
|
|
|
|
packer validate \
|
|
|
|
-only=vsphere-iso.bootstrap \
|
|
|
|
-var vm_name=${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA:0:10}-$(openssl rand -hex 3) \
|
|
|
|
-var docker_username=$${DOCKER_USERNAME} \
|
|
|
|
-var docker_password=$${DOCKER_PASSWORD} \
|
|
|
|
-var repo_username=$${REPO_USERNAME} \
|
|
|
|
-var repo_password=$${REPO_PASSWORD} \
|
|
|
|
-var ssh_password=$${SSH_PASSWORD} \
|
|
|
|
-var vsphere_password=$${VSPHERE_PASSWORD} \
|
|
|
|
-var k8s_version=$K8S_VERSION \
|
|
|
|
-var next_release_version=$NEXT_RELEASE_VERSION \
|
|
|
|
./packer
|
|
|
|
- |
|
|
|
|
packer build \
|
|
|
|
-on-error=cleanup -timestamp-ui \
|
|
|
|
-only=vsphere-iso.bootstrap \
|
|
|
|
-var vm_name=${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA:0:10}-$(openssl rand -hex 3) \
|
|
|
|
-var docker_username=$${DOCKER_USERNAME} \
|
|
|
|
-var docker_password=$${DOCKER_PASSWORD} \
|
|
|
|
-var repo_username=$${REPO_USERNAME} \
|
|
|
|
-var repo_password=$${REPO_PASSWORD} \
|
|
|
|
-var ssh_password=$${SSH_PASSWORD} \
|
|
|
|
-var vsphere_password=$${VSPHERE_PASSWORD} \
|
|
|
|
-var k8s_version=$K8S_VERSION \
|
|
|
|
-var next_release_version=$NEXT_RELEASE_VERSION \
|
|
|
|
./packer
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME:
|
|
|
|
from_secret: docker_username
|
|
|
|
DOCKER_PASSWORD:
|
|
|
|
from_secret: docker_password
|
|
|
|
# PACKER_LOG: 1
|
|
|
|
REPO_USERNAME:
|
|
|
|
from_secret: repo_username
|
|
|
|
REPO_PASSWORD:
|
|
|
|
from_secret: repo_password
|
|
|
|
SSH_PASSWORD:
|
|
|
|
from_secret: ssh_password
|
|
|
|
VSPHERE_PASSWORD:
|
|
|
|
from_secret: vsphere_password
|
|
|
|
volumes:
|
|
|
|
- name: output
|
|
|
|
path: /output
|
|
|
|
- name: scratch
|
|
|
|
path: /scratch
|
2023-04-03 13:43:10 +00:00
|
|
|
|
2023-05-22 10:19:10 +00:00
|
|
|
- name: Kubernetes Upgrade Appliance
|
|
|
|
depends_on:
|
|
|
|
- Install Ansible Galaxy collections
|
|
|
|
image: bv11-cr01.bessems.eu/library/packer-extended
|
|
|
|
pull: alwaysquery(
|
|
|
|
commands:
|
|
|
|
- |
|
|
|
|
sed -i -e "s/<<img-password>>/$${SSH_PASSWORD}/g" \
|
|
|
|
packer/preseed/UbuntuServer22.04/user-data
|
|
|
|
- |
|
|
|
|
export K8S_VERSION=$(yq '.components.clusterapi.workload.version.k8s' < ./ansible/vars/metacluster.yml)
|
2023-05-22 11:43:53 +00:00
|
|
|
export NEXT_RELEASE_VERSION=$(cat .version)
|
2023-05-22 10:19:10 +00:00
|
|
|
- |
|
|
|
|
packer init -upgrade \
|
|
|
|
./packer
|
|
|
|
- |
|
|
|
|
packer validate \
|
|
|
|
-only=vsphere-iso.upgrade \
|
|
|
|
-var vm_name=${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA:0:10}-$(openssl rand -hex 3) \
|
|
|
|
-var docker_username=$${DOCKER_USERNAME} \
|
|
|
|
-var docker_password=$${DOCKER_PASSWORD} \
|
|
|
|
-var repo_username=$${REPO_USERNAME} \
|
|
|
|
-var repo_password=$${REPO_PASSWORD} \
|
|
|
|
-var ssh_password=$${SSH_PASSWORD} \
|
|
|
|
-var vsphere_password=$${VSPHERE_PASSWORD} \
|
|
|
|
-var k8s_version=$K8S_VERSION \
|
|
|
|
-var next_release_version=$NEXT_RELEASE_VERSION \
|
|
|
|
./packer
|
|
|
|
- |
|
|
|
|
packer build \
|
|
|
|
-on-error=cleanup -timestamp-ui \
|
|
|
|
-only=vsphere-iso.upgrade \
|
|
|
|
-var vm_name=${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA:0:10}-$(openssl rand -hex 3) \
|
|
|
|
-var docker_username=$${DOCKER_USERNAME} \
|
|
|
|
-var docker_password=$${DOCKER_PASSWORD} \
|
|
|
|
-var repo_username=$${REPO_USERNAME} \
|
|
|
|
-var repo_password=$${REPO_PASSWORD} \
|
|
|
|
-var ssh_password=$${SSH_PASSWORD} \
|
|
|
|
-var vsphere_password=$${VSPHERE_PASSWORD} \
|
|
|
|
-var k8s_version=$K8S_VERSION \
|
|
|
|
-var next_release_version=$NEXT_RELEASE_VERSION \
|
|
|
|
./packer
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME:
|
|
|
|
from_secret: docker_username
|
|
|
|
DOCKER_PASSWORD:
|
|
|
|
from_secret: docker_password
|
|
|
|
# PACKER_LOG: 1
|
|
|
|
REPO_USERNAME:
|
|
|
|
from_secret: repo_username
|
|
|
|
REPO_PASSWORD:
|
|
|
|
from_secret: repo_password
|
|
|
|
SSH_PASSWORD:
|
|
|
|
from_secret: ssh_password
|
|
|
|
VSPHERE_PASSWORD:
|
|
|
|
from_secret: vsphere_password
|
|
|
|
volumes:
|
|
|
|
- name: output
|
|
|
|
path: /output
|
|
|
|
- name: scratch
|
|
|
|
path: /scratch
|
2023-04-03 13:43:10 +00:00
|
|
|
|
2023-05-22 10:19:10 +00:00
|
|
|
- name: Remove temporary resources
|
|
|
|
depends_on:
|
|
|
|
- Kubernetes Bootstrap Appliance
|
|
|
|
- Kubernetes Upgrade Appliance
|
|
|
|
image: bv11-cr01.bessems.eu/library/packer-extended
|
|
|
|
commands:
|
|
|
|
- |
|
|
|
|
pwsh -file scripts/Remove-Resources.ps1 \
|
|
|
|
-VMName $DRONE_BUILD_NUMBER-${DRONE_COMMIT_SHA:0:10} \
|
|
|
|
-VSphereFQDN 'bv11-vc.bessems.lan' \
|
|
|
|
-VSphereUsername 'administrator@vsphere.local' \
|
|
|
|
-VSpherePassword $${VSPHERE_PASSWORD}
|
|
|
|
environment:
|
|
|
|
VSPHERE_PASSWORD:
|
|
|
|
from_secret: vsphere_password
|
|
|
|
volumes:
|
|
|
|
- name: scratch
|
|
|
|
path: /scratch
|
|
|
|
when:
|
|
|
|
status:
|
|
|
|
- success
|
|
|
|
- failure
|