From 439223c56e3d3571f4c0388d68db70761d0c2ee4 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Wed, 22 Mar 2023 08:54:45 +0100 Subject: [PATCH 01/36] Build n-1 version --- ansible/vars/metacluster.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ansible/vars/metacluster.yml b/ansible/vars/metacluster.yml index b5b1e90..4af907d 100644 --- a/ansible/vars/metacluster.yml +++ b/ansible/vars/metacluster.yml @@ -1,7 +1,7 @@ platform: k3s: - version: v1.26.2+k3s1 + version: v1.25.7+k3s1 gitops: repository: @@ -93,9 +93,9 @@ components: workload: version: calico: v3.25.0 - k8s: v1.26.3 + k8s: v1.25.8 node_template: - url: https://{{ repo_username }}:{{ repo_password }}@sn.itch.fyi/Repository/rel/ubuntu-2004-kube-v1.26.3.ova + url: https://{{ repo_username }}:{{ repo_password }}@sn.itch.fyi/Repository/rel/ubuntu-2004-kube-v1.25.8.ova dex: helm: From 942c13dde7465507076513f272c252bab3a6ad4d Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Thu, 23 Mar 2023 11:42:34 +0100 Subject: [PATCH 02/36] Improve console healthchecks --- .../common/roles/tty/tasks/main.yml | 19 +++++++++++++++++++ .../ansible_payload/common/templates/tty.j2 | 15 +++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/ansible/roles/firstboot/files/ansible_payload/common/roles/tty/tasks/main.yml b/ansible/roles/firstboot/files/ansible_payload/common/roles/tty/tasks/main.yml index 81cd533..9bf2ec9 100644 --- a/ansible/roles/firstboot/files/ansible_payload/common/roles/tty/tasks/main.yml +++ b/ansible/roles/firstboot/files/ansible_payload/common/roles/tty/tasks/main.yml @@ -19,6 +19,25 @@ executable: /opt/firstboot/tty.sh workingdir: /tmp/ metacluster: + components: + - name: ArgoCD + url: https://gitops.${FQDN} + healthcheck: https://gitops.${FQDN} + - name: Gitea + url: https://git.${FQDN} + healthcheck: https://git.${FQDN} + - name: Harbor + url: https://registry.${FQDN} + healthcheck: https://registry.${FQDN} + - name: Longhorn + url: https://storage.${FQDN} + healthcheck: https://storage.${FQDN} + - name: StepCA + url: '' + healthcheck: https://ca.${FQDN}/health + - name: Traefik + url: https://ingress.${FQDN} + healthcheck: https://ingress.${FQDN} fqdn: "{{ vapp['metacluster.fqdn'] }}" vip: "{{ vapp['metacluster.vip'] }}" loop: diff --git a/ansible/roles/firstboot/files/ansible_payload/common/templates/tty.j2 b/ansible/roles/firstboot/files/ansible_payload/common/templates/tty.j2 index d9f1c49..8eb0e83 100644 --- a/ansible/roles/firstboot/files/ansible_payload/common/templates/tty.j2 +++ b/ansible/roles/firstboot/files/ansible_payload/common/templates/tty.j2 @@ -12,11 +12,14 @@ DFLT='\033[0m' # Reset colour LCLR='\033[K' # Clear to end of line PRST='\033[0;0H' # Reset cursor position -# COMPONENTS=('ca' 'ingress' 'storage' 'registry' 'git' 'gitops') -COMPONENTS=('storage' 'registry' 'git' 'gitops') FQDN='{{ _template.metacluster.fqdn }}' IPADDRESS='{{ _template.metacluster.vip }}' +declare -A COMPONENTS +{% for component in _template.metacluster.components %} +COMPONENTS["{{ component.name }}\t({{ component.url }})"]="{{ component.healthcheck }}" +{% endfor %} + I=0 while /bin/true; do @@ -30,13 +33,13 @@ while /bin/true; do echo -e "${PRST}" > /dev/tty1 echo -e "\n\n\t${DFLT}To manage this appliance, please connect to one of the following:${LCLR}\n" > /dev/tty1 - for c in "${COMPONENTS[@]}"; do - STATUS=$(curl -ks "https://${c}.${FQDN}" -o /dev/null -w '%{http_code}') + for c in "${!COMPONENTS[@]}"; do + STATUS=$(curl -kLs "${COMPONENTS[${c}]}" -o /dev/null -w '%{http_code}') if [[ "${STATUS}" -eq "200" ]]; then - echo -e "\t [${BGRN}+${DFLT}] ${BBLU}https://${c}.${FQDN}${DFLT}${LCLR}" > /dev/tty1 + echo -e "\t [${BGRN}+${DFLT}] ${BBLU}${c}${DFLT}${LCLR}" > /dev/tty1 else - echo -e "\t [${BRED}-${DFLT}] ${BBLU}https://${c}.${FQDN}${DFLT}${LCLR}" > /dev/tty1 + echo -e "\t [${BRED}-${DFLT}] ${BBLU}${c}${DFLT}${LCLR}" > /dev/tty1 fi done From 1c1970885511bce8da9a0b3b243ff915399e1a3f Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Thu, 23 Mar 2023 16:51:17 +0100 Subject: [PATCH 03/36] Increase default retries;Add healthcheck --- .../bootstrap/roles/workloadcluster/tasks/clusterapi.yml | 4 +++- .../firstboot/files/ansible_payload/common/vars/defaults.yml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/workloadcluster/tasks/clusterapi.yml b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/workloadcluster/tasks/clusterapi.yml index 29154cb..4281c54 100644 --- a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/workloadcluster/tasks/clusterapi.yml +++ b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/workloadcluster/tasks/clusterapi.yml @@ -99,7 +99,7 @@ --kubeconfig {{ kubeconfig.path }} chdir: /opt/metacluster/cluster-api -- name: Ensure CAPI/CAPV controller availability +- name: Ensure controller availability kubernetes.core.k8s_info: kind: Deployment name: "{{ item.name }}" @@ -107,6 +107,8 @@ wait: true kubeconfig: "{{ kubeconfig.path }}" loop: + - name: caip-in-cluster-controller-manager + namespace: caip-in-cluster-system - name: capi-controller-manager namespace: capi-system - name: capv-controller-manager diff --git a/ansible/roles/firstboot/files/ansible_payload/common/vars/defaults.yml b/ansible/roles/firstboot/files/ansible_payload/common/vars/defaults.yml index 8cf3e3c..c3b1df9 100644 --- a/ansible/roles/firstboot/files/ansible_payload/common/vars/defaults.yml +++ b/ansible/roles/firstboot/files/ansible_payload/common/vars/defaults.yml @@ -1,5 +1,5 @@ playbook: - retries: 5 + retries: 10 delay: # These values are multiplied with the value of `storage_benchmark` long: 2 From 31b21c9b7afa84e6744b9f0e6e919d3091600e1d Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Fri, 19 May 2023 12:19:42 +0200 Subject: [PATCH 04/36] Upgrade node template OS version --- ansible/vars/metacluster.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/vars/metacluster.yml b/ansible/vars/metacluster.yml index 2230376..88b913b 100644 --- a/ansible/vars/metacluster.yml +++ b/ansible/vars/metacluster.yml @@ -121,7 +121,7 @@ components: calico: v3.25.0 k8s: v1.25.9 node_template: - url: https://{{ repo_username }}:{{ repo_password }}@sn.itch.fyi/Repository/rel/ubuntu-2004-kube-v1.25.9.ova + url: https://{{ repo_username }}:{{ repo_password }}@sn.itch.fyi/Repository/rel/ubuntu-2204-kube-v1.25.9.ova # dex: # helm: From 68445ee13f8329d69f647efcf6d89d1a72d2cfae Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sat, 20 May 2023 12:44:32 +0200 Subject: [PATCH 05/36] Testing semantic-release --- .drone.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index b4b91b8..a7f8a42 100644 --- a/.drone.yml +++ b/.drone.yml @@ -32,9 +32,20 @@ steps: packer/preseed/UbuntuServer22.04/user-data \ scripts -- name: Install Ansible Galaxy collections +- name: Semantic Release (Dry-run) depends_on: - Linting + image: bv11-cr01.bessems.eu/proxy/library/node:20-slim + pull: always + commands: + - | + npm install semantic-release + - | + npx semantic-release --dry-run + +- name: Install Ansible Galaxy collections + depends_on: + - Semantic Release (Dry-run) image: bv11-cr01.bessems.eu/library/packer-extended pull: always commands: From 6d168f0517bab3ad7dc0f9fb269ba15df1a1adaa Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sat, 20 May 2023 12:48:40 +0200 Subject: [PATCH 06/36] Add semantic-release prerequisites --- .drone.yml | 308 +++++++++++++++++++++++++++-------------------------- 1 file changed, 157 insertions(+), 151 deletions(-) diff --git a/.drone.yml b/.drone.yml index a7f8a42..dec55af 100644 --- a/.drone.yml +++ b/.drone.yml @@ -38,162 +38,168 @@ steps: image: bv11-cr01.bessems.eu/proxy/library/node:20-slim pull: always commands: + - | + apt-get update + - | + apt-get install -y --no-install-recommends \ + git-core \ + ca-certificates - | npm install semantic-release - | npx semantic-release --dry-run -- 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: 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/<>/$${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 Bootstrap Appliance +# depends_on: +# - Install Ansible Galaxy collections +# image: bv11-cr01.bessems.eu/library/packer-extended +# pull: always +# commands: +# - | +# sed -i -e "s/<>/$${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/<>/$${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: Kubernetes Upgrade Appliance +# depends_on: +# - Install Ansible Galaxy collections +# image: bv11-cr01.bessems.eu/library/packer-extended +# pull: alwaysquery( +# commands: +# - | +# sed -i -e "s/<>/$${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 From fe5147bd2edd9d00aa3a72c12ad4a8bb8552bbb0 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sat, 20 May 2023 12:58:44 +0200 Subject: [PATCH 07/36] Override branch during semantic-release dry-run --- .drone.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index dec55af..b35096e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -47,7 +47,9 @@ steps: - | npm install semantic-release - | - npx semantic-release --dry-run + npx semantic-release \ + --branches ${DRONE_BRANCH} + --dry-run # - name: Install Ansible Galaxy collections # depends_on: From a46610f828e1c009334220470d8f927b6b2cad64 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sat, 20 May 2023 13:22:20 +0200 Subject: [PATCH 08/36] Add git credentials --- .drone.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index b35096e..c49d949 100644 --- a/.drone.yml +++ b/.drone.yml @@ -46,10 +46,17 @@ steps: ca-certificates - | npm install semantic-release + - | + export GIT_CREDENTIALS=${GIT_USERNAME}:${GIT_APIKEY} - | npx semantic-release \ - --branches ${DRONE_BRANCH} + --branches ${DRONE_BRANCH} \ + --repository-url --dry-run + environment: + GIT_APIKEY: + from_secret: git_apikey + GIT_USERNAME: djpbessems # - name: Install Ansible Galaxy collections # depends_on: From c83d541a0da26143b059c24562e3d16334131875 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sat, 20 May 2023 13:24:20 +0200 Subject: [PATCH 09/36] Remove redundant parameter --- .drone.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index c49d949..8f60196 100644 --- a/.drone.yml +++ b/.drone.yml @@ -51,7 +51,6 @@ steps: - | npx semantic-release \ --branches ${DRONE_BRANCH} \ - --repository-url --dry-run environment: GIT_APIKEY: From 75158a8a5bc84efc6a6eaddbf8beb543f76d21c6 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sat, 20 May 2023 13:26:49 +0200 Subject: [PATCH 10/36] Fix variable substitution --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 8f60196..9afd4c8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -47,7 +47,7 @@ steps: - | npm install semantic-release - | - export GIT_CREDENTIALS=${GIT_USERNAME}:${GIT_APIKEY} + export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY} - | npx semantic-release \ --branches ${DRONE_BRANCH} \ From e4e58e47895c34e352b8de15d354086ad6ce12ae Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sat, 20 May 2023 13:31:48 +0200 Subject: [PATCH 11/36] Disable npm plugin --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index 9afd4c8..4013fce 100644 --- a/.drone.yml +++ b/.drone.yml @@ -51,6 +51,7 @@ steps: - | npx semantic-release \ --branches ${DRONE_BRANCH} \ + --plugins ['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/github'] \ --dry-run environment: GIT_APIKEY: From 0fee2df2a6e8d172a36815f4d289b329e99f7a8a Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sat, 20 May 2023 13:44:54 +0200 Subject: [PATCH 12/36] Explicitly install semantic-release plugins --- .drone.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 4013fce..78abb9a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -45,13 +45,17 @@ steps: git-core \ ca-certificates - | - npm install semantic-release + npm install \ + semantic-release \ + @semantic-release/commit-analyzer \ + @semantic-release/release-notes-generator\ + @semantic-release/exec' - | export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY} - | npx semantic-release \ --branches ${DRONE_BRANCH} \ - --plugins ['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/github'] \ + --plugins ['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/exec'] \ --dry-run environment: GIT_APIKEY: From 358cbe39ea09597d5184c0163f34262761a391dd Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sat, 20 May 2023 14:28:31 +0200 Subject: [PATCH 13/36] Fix quote --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 78abb9a..f6f7566 100644 --- a/.drone.yml +++ b/.drone.yml @@ -49,7 +49,7 @@ steps: semantic-release \ @semantic-release/commit-analyzer \ @semantic-release/release-notes-generator\ - @semantic-release/exec' + @semantic-release/exec - | export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY} - | From 9cb89bf055a2c9a89001ad73a201d999b1bfb972 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sat, 20 May 2023 14:30:38 +0200 Subject: [PATCH 14/36] Try different syntax --- .drone.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index f6f7566..49a5501 100644 --- a/.drone.yml +++ b/.drone.yml @@ -46,16 +46,13 @@ steps: ca-certificates - | npm install \ - semantic-release \ - @semantic-release/commit-analyzer \ - @semantic-release/release-notes-generator\ - @semantic-release/exec + semantic-release - | export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY} - | npx semantic-release \ --branches ${DRONE_BRANCH} \ - --plugins ['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/exec'] \ + --plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator,@semantic-release/exec \ --dry-run environment: GIT_APIKEY: From 823cc467fa4038fb488285e50eaedcd80a1cca21 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sat, 20 May 2023 14:32:47 +0200 Subject: [PATCH 15/36] Explicitly install semantic-release plugins #2 --- .drone.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 49a5501..0b4fca9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -46,7 +46,10 @@ steps: ca-certificates - | npm install \ - semantic-release + semantic-release \ + @semantic-release/commit-analyzer \ + @semantic-release/release-notes-generator\ + @semantic-release/exec - | export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY} - | From cce39a5bb757c1c2e6a4a0f4e42a65a3e6540ac0 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sat, 20 May 2023 15:18:23 +0200 Subject: [PATCH 16/36] fix:Test semantic release dry-run --- .drone.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.drone.yml b/.drone.yml index 0b4fca9..e122ea2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -62,6 +62,8 @@ steps: from_secret: git_apikey GIT_USERNAME: djpbessems +# Add random change for testing semantic release commit + # - name: Install Ansible Galaxy collections # depends_on: # - Semantic Release (Dry-run) From 0d1db2f29f4af22586847f222ed5ced90e11a3b5 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sun, 21 May 2023 17:51:04 +0200 Subject: [PATCH 17/36] feat: Test semantic-release dry-run #2 --- .drone.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index e122ea2..0b4fca9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -62,8 +62,6 @@ steps: from_secret: git_apikey GIT_USERNAME: djpbessems -# Add random change for testing semantic release commit - # - name: Install Ansible Galaxy collections # depends_on: # - Semantic Release (Dry-run) From 24dca2755a28f9c660ad7939030cb1665b80549a Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sun, 21 May 2023 18:02:00 +0200 Subject: [PATCH 18/36] fix: Run semantic-release with different drone variable as input --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 0b4fca9..02b9c43 100644 --- a/.drone.yml +++ b/.drone.yml @@ -54,7 +54,7 @@ steps: export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY} - | npx semantic-release \ - --branches ${DRONE_BRANCH} \ + --branches ${DRONE_REPO_BRANCH} \ --plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator,@semantic-release/exec \ --dry-run environment: From 9b9ab6b784e46fc3837a1faaded71255d76efa2b Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sun, 21 May 2023 18:09:22 +0200 Subject: [PATCH 19/36] build:Skip build on tag --- .drone.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 02b9c43..b913641 100644 --- a/.drone.yml +++ b/.drone.yml @@ -10,6 +10,11 @@ volumes: claim: name: flexvolsmb-drone-scratch +trigger: + event: + exclude: + - tag + steps: - name: Debugging information image: bv11-cr01.bessems.eu/library/packer-extended @@ -54,7 +59,7 @@ steps: export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY} - | npx semantic-release \ - --branches ${DRONE_REPO_BRANCH} \ + --branches ${DRONE_BRANCH} \ --plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator,@semantic-release/exec \ --dry-run environment: From 978f39d45b01b6cdf0d69763b307a15918dd8f6d Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sun, 21 May 2023 18:27:34 +0200 Subject: [PATCH 20/36] build: Test different semantic-release plugins --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index b913641..eba43ef 100644 --- a/.drone.yml +++ b/.drone.yml @@ -54,13 +54,13 @@ steps: semantic-release \ @semantic-release/commit-analyzer \ @semantic-release/release-notes-generator\ - @semantic-release/exec + @semantic-release/git - | export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY} - | npx semantic-release \ --branches ${DRONE_BRANCH} \ - --plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator,@semantic-release/exec \ + --plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator,@semantic-release/git \ --dry-run environment: GIT_APIKEY: From 5b950a383406509d1decbf6a2c2fac52c7074000 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Mon, 22 May 2023 09:09:50 +0200 Subject: [PATCH 21/36] build:Test with configuration in .releaserc.json --- .drone.yml | 2 +- .releaserc.json | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .releaserc.json diff --git a/.drone.yml b/.drone.yml index eba43ef..90ecbfb 100644 --- a/.drone.yml +++ b/.drone.yml @@ -54,13 +54,13 @@ steps: semantic-release \ @semantic-release/commit-analyzer \ @semantic-release/release-notes-generator\ + @semantic-release/exec \ @semantic-release/git - | export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY} - | npx semantic-release \ --branches ${DRONE_BRANCH} \ - --plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator,@semantic-release/git \ --dry-run environment: GIT_APIKEY: diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..abbe796 --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + ["@semantic-release/commit-analyzer"], + ["@semantic-release/release-notes-generator"], + ["@semantic-release/exec", { + "prepareCmd": "export SEMANTICRELEASE_NEXTRELEASEVERSION=${nextRelease.version}", + "publishCmd": "echo $SEMANTICRELEASE_NEXTRELEASEVERSION" + }], + ["@semantic-release/git"] + ] +} From f1dfc83d7c75b8f3c0e56a86bce49c428a908eb1 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Mon, 22 May 2023 09:23:44 +0200 Subject: [PATCH 22/36] build:Revert back to cli arguments while specifying custom command --- .drone.yml | 22 ++++++++++++++++++--- .releaserc.json => .releaserc.json.DISABLED | 0 2 files changed, 19 insertions(+), 3 deletions(-) rename .releaserc.json => .releaserc.json.DISABLED (100%) diff --git a/.drone.yml b/.drone.yml index 90ecbfb..cde320c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -53,20 +53,36 @@ steps: npm install \ semantic-release \ @semantic-release/commit-analyzer \ - @semantic-release/release-notes-generator\ @semantic-release/exec \ - @semantic-release/git - | export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY} - | + # npx semantic-release \ + # --branches ${DRONE_BRANCH} \ + # --dry-run npx semantic-release \ + --package @semantic-release/exec \ + --package semantic-release \ --branches ${DRONE_BRANCH} \ - --dry-run + --dry-run \ + --plugins @semantic-release/commit-analyzer,@semantic-release/exec \ + --analyzeCommits @semantic-release/commit-analyzer \ + --verifyRelease @semantic-release/exec \ + --verifyReleaseCmd 'echo ${nextRelease.version} > .\.version' environment: GIT_APIKEY: from_secret: git_apikey GIT_USERNAME: djpbessems +- name: Print version + depends_on: + - Semantic Release (Dry-run) + image: bv11-cr01.bessems.eu/library/packer-extended + pull: always + commands: + - | + cat .version + # - name: Install Ansible Galaxy collections # depends_on: # - Semantic Release (Dry-run) diff --git a/.releaserc.json b/.releaserc.json.DISABLED similarity index 100% rename from .releaserc.json rename to .releaserc.json.DISABLED From 263f156eb1bff74a4f6b544bdba8189d18303ca3 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Mon, 22 May 2023 11:55:28 +0200 Subject: [PATCH 23/36] build:Try different syntax --- .drone.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index cde320c..b76105c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -57,9 +57,6 @@ steps: - | export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY} - | - # npx semantic-release \ - # --branches ${DRONE_BRANCH} \ - # --dry-run npx semantic-release \ --package @semantic-release/exec \ --package semantic-release \ @@ -68,7 +65,7 @@ steps: --plugins @semantic-release/commit-analyzer,@semantic-release/exec \ --analyzeCommits @semantic-release/commit-analyzer \ --verifyRelease @semantic-release/exec \ - --verifyReleaseCmd 'echo ${nextRelease.version} > .\.version' + --verifyReleaseCmd "echo \${nextRelease.version} > .\.version" environment: GIT_APIKEY: from_secret: git_apikey From 479d896599463d2e70907a355a4564117c4145dd Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Mon, 22 May 2023 12:05:32 +0200 Subject: [PATCH 24/36] build:Debug brace mismatch --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index b76105c..37e543d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -72,8 +72,8 @@ steps: GIT_USERNAME: djpbessems - name: Print version - depends_on: - - Semantic Release (Dry-run) + # depends_on: + # - Semantic Release (Dry-run) image: bv11-cr01.bessems.eu/library/packer-extended pull: always commands: From 8fd0136bb74ac7bb857438a9ffb841e735f896a1 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Mon, 22 May 2023 12:06:14 +0200 Subject: [PATCH 25/36] build:debug brace mismatch #2 --- .drone.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 37e543d..22cbe44 100644 --- a/.drone.yml +++ b/.drone.yml @@ -65,15 +65,15 @@ steps: --plugins @semantic-release/commit-analyzer,@semantic-release/exec \ --analyzeCommits @semantic-release/commit-analyzer \ --verifyRelease @semantic-release/exec \ - --verifyReleaseCmd "echo \${nextRelease.version} > .\.version" + --verifyReleaseCmd "echo foo > .\.version" environment: GIT_APIKEY: from_secret: git_apikey GIT_USERNAME: djpbessems - name: Print version - # depends_on: - # - Semantic Release (Dry-run) + depends_on: + - Semantic Release (Dry-run) image: bv11-cr01.bessems.eu/library/packer-extended pull: always commands: From b808397d4793593677627bf3304b14deeb57f86c Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Mon, 22 May 2023 12:08:01 +0200 Subject: [PATCH 26/36] build:Fix var substitution --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 22cbe44..68f7611 100644 --- a/.drone.yml +++ b/.drone.yml @@ -65,7 +65,7 @@ steps: --plugins @semantic-release/commit-analyzer,@semantic-release/exec \ --analyzeCommits @semantic-release/commit-analyzer \ --verifyRelease @semantic-release/exec \ - --verifyReleaseCmd "echo foo > .\.version" + --verifyReleaseCmd 'echo $${nextRelease.version} > .\.version' environment: GIT_APIKEY: from_secret: git_apikey From 0468cd6269c25260c52067feed56d0378390fee1 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Mon, 22 May 2023 12:11:14 +0200 Subject: [PATCH 27/36] build:Debug echo to file --- .drone.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 68f7611..81e0756 100644 --- a/.drone.yml +++ b/.drone.yml @@ -65,7 +65,9 @@ steps: --plugins @semantic-release/commit-analyzer,@semantic-release/exec \ --analyzeCommits @semantic-release/commit-analyzer \ --verifyRelease @semantic-release/exec \ - --verifyReleaseCmd 'echo $${nextRelease.version} > .\.version' + --verifyReleaseCmd 'echo "$${nextRelease.version}" > .version' + - | + ls -lash environment: GIT_APIKEY: from_secret: git_apikey From 8b4a1e380cc069711ef4d695c2c0df6887274a5f Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Mon, 22 May 2023 12:19:10 +0200 Subject: [PATCH 28/36] build:Test semantic-release + build flow --- .drone.yml | 303 +++++++++++++++++++-------------------- packer/build.pkr.hcl | 2 +- packer/variables.pkr.hcl | 1 + 3 files changed, 149 insertions(+), 157 deletions(-) diff --git a/.drone.yml b/.drone.yml index 81e0756..792da91 100644 --- a/.drone.yml +++ b/.drone.yml @@ -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/<>/$${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/<>/$${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/<>/$${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/<>/$${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 diff --git a/packer/build.pkr.hcl b/packer/build.pkr.hcl index 2a1b241..e251b0f 100644 --- a/packer/build.pkr.hcl +++ b/packer/build.pkr.hcl @@ -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" ] } } diff --git a/packer/variables.pkr.hcl b/packer/variables.pkr.hcl index 9c4cba0..d976d01 100644 --- a/packer/variables.pkr.hcl +++ b/packer/variables.pkr.hcl @@ -35,3 +35,4 @@ variable "docker_password" { } variable "k8s_version" {} +variable "next_release_version" {} From 679a9457b5fe1fdca147a026db0ce9e225d49abf Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Mon, 22 May 2023 12:44:13 +0200 Subject: [PATCH 29/36] build:Fix variable name --- packer/build.pkr.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packer/build.pkr.hcl b/packer/build.pkr.hcl index e251b0f..255b956 100644 --- a/packer/build.pkr.hcl +++ b/packer/build.pkr.hcl @@ -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.next-release-version}+${var.k8s_version}-${source.name}.ova" + " /output/airgapped-k8s-${var.next_release_version}+${var.k8s_version}-${source.name}.ova" ] } } From 438b944011990e0c63b7ca7a531171bea31c5b32 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Mon, 22 May 2023 13:43:53 +0200 Subject: [PATCH 30/36] build: Add missing variable export --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index 792da91..cea2794 100644 --- a/.drone.yml +++ b/.drone.yml @@ -155,6 +155,7 @@ steps: 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 From cf001cd0cefd8c52def88dd71489243b84ee36cc Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Tue, 20 Jun 2023 15:32:53 +0200 Subject: [PATCH 31/36] build:Test explicit tag format --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index cea2794..5127afd 100644 --- a/.drone.yml +++ b/.drone.yml @@ -61,6 +61,7 @@ steps: --package @semantic-release/exec \ --package semantic-release \ --branches ${DRONE_BRANCH} \ + --tag-format "K8s_1.25.9-v\${version}" --dry-run \ --plugins @semantic-release/commit-analyzer,@semantic-release/exec \ --analyzeCommits @semantic-release/commit-analyzer \ From 7fd1cf73db7e900e9938c5d9a463a232a4eccdce Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Tue, 20 Jun 2023 15:35:09 +0200 Subject: [PATCH 32/36] build: Fix linebreak --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 5127afd..2954f00 100644 --- a/.drone.yml +++ b/.drone.yml @@ -61,7 +61,7 @@ steps: --package @semantic-release/exec \ --package semantic-release \ --branches ${DRONE_BRANCH} \ - --tag-format "K8s_1.25.9-v\${version}" + --tag-format "K8s_1.25.9-v\${version}" \ --dry-run \ --plugins @semantic-release/commit-analyzer,@semantic-release/exec \ --analyzeCommits @semantic-release/commit-analyzer \ From 2e8ce6cc007fa426cf04c50cb4d0706f0c8453eb Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Tue, 20 Jun 2023 15:37:36 +0200 Subject: [PATCH 33/36] build: Escape escape sequence characters --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 2954f00..784f1f4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -61,7 +61,7 @@ steps: --package @semantic-release/exec \ --package semantic-release \ --branches ${DRONE_BRANCH} \ - --tag-format "K8s_1.25.9-v\${version}" \ + --tag-format "K8s_1.25.9-v\$${version}" \ --dry-run \ --plugins @semantic-release/commit-analyzer,@semantic-release/exec \ --analyzeCommits @semantic-release/commit-analyzer \ From c177dbd03b216408efd3ccac3c628e52d7db70d8 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Tue, 20 Jun 2023 15:40:39 +0200 Subject: [PATCH 34/36] build: Test different syntax for character escape --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 784f1f4..830877f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -61,7 +61,7 @@ steps: --package @semantic-release/exec \ --package semantic-release \ --branches ${DRONE_BRANCH} \ - --tag-format "K8s_1.25.9-v\$${version}" \ + --tag-format "K8s_1.25.9-v\$\${version}" \ --dry-run \ --plugins @semantic-release/commit-analyzer,@semantic-release/exec \ --analyzeCommits @semantic-release/commit-analyzer \ From ba4a0148ff6a0efb733eb68999fc6e11c4e5b692 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Tue, 20 Jun 2023 15:44:45 +0200 Subject: [PATCH 35/36] build: Try different syntax (remove quotes) --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 830877f..45f69f1 100644 --- a/.drone.yml +++ b/.drone.yml @@ -61,7 +61,7 @@ steps: --package @semantic-release/exec \ --package semantic-release \ --branches ${DRONE_BRANCH} \ - --tag-format "K8s_1.25.9-v\$\${version}" \ + --tag-format K8s_1.25.9-v$${version} \ --dry-run \ --plugins @semantic-release/commit-analyzer,@semantic-release/exec \ --analyzeCommits @semantic-release/commit-analyzer \ From 1f55ff7cfae3bfb7f71cd5c5c92541cfeb041ae7 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Tue, 20 Jun 2023 16:30:49 +0200 Subject: [PATCH 36/36] build: Revert to semi-working syntax --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 45f69f1..784f1f4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -61,7 +61,7 @@ steps: --package @semantic-release/exec \ --package semantic-release \ --branches ${DRONE_BRANCH} \ - --tag-format K8s_1.25.9-v$${version} \ + --tag-format "K8s_1.25.9-v\$${version}" \ --dry-run \ --plugins @semantic-release/commit-analyzer,@semantic-release/exec \ --analyzeCommits @semantic-release/commit-analyzer \