build:Test semantic-release + build flow
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Danny Bessems 2023-05-22 12:19:10 +02:00
parent 0468cd6269
commit 8b4a1e380c
3 changed files with 149 additions and 157 deletions

View File

@ -66,173 +66,164 @@ steps:
--analyzeCommits @semantic-release/commit-analyzer \
--verifyRelease @semantic-release/exec \
--verifyReleaseCmd 'echo "$${nextRelease.version}" > .version'
- |
ls -lash
environment:
GIT_APIKEY:
from_secret: git_apikey
GIT_USERNAME: djpbessems
- name: Print version
- name: Install Ansible Galaxy collections
depends_on:
- Semantic Release (Dry-run)
image: bv11-cr01.bessems.eu/library/packer-extended
pull: always
commands:
- |
cat .version
ansible-galaxy collection install \
-r ansible/requirements.yml \
-p ./ansible/collections
# - name: Install Ansible Galaxy collections
# depends_on:
# - Semantic Release (Dry-run)
# image: bv11-cr01.bessems.eu/library/packer-extended
# pull: always
# commands:
# - |
# ansible-galaxy collection install \
# -r ansible/requirements.yml \
# -p ./ansible/collections
# volumes:
# - name: scratch
# path: /scratch
- 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
# - 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)
# - |
# 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 \
# ./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 \
# ./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
- 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)
- |
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
# - 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)
# - |
# 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 \
# ./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 \
# ./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
# - 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
- 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

View File

@ -45,7 +45,7 @@ build {
" -ManifestFileName '/scratch/bld_${var.vm_name}_${source.name}.mf'",
"ovftool --acceptAllEulas --allowExtraConfig --overwrite \\",
" '/scratch/bld_${var.vm_name}_${source.name}.ovf' \\",
" /output/airgapped-k8s-${var.k8s_version}.${source.name}.ova"
" /output/airgapped-k8s-${var.next-release-version}+${var.k8s_version}-${source.name}.ova"
]
}
}

View File

@ -35,3 +35,4 @@ variable "docker_password" {
}
variable "k8s_version" {}
variable "next_release_version" {}