diff --git a/.drone.yml b/.drone.yml index 4f2facf..ed4bb84 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 @@ -21,8 +26,6 @@ steps: - yamllint --version - name: Linting - # depends_on: - # - Debugging information image: bv11-cr01.bessems.eu/library/packer-extended pull: always commands: @@ -32,9 +35,48 @@ steps: packer/preseed/UbuntuServer22.04/user-data \ scripts +- name: Semantic Release (Dry-run) + image: bv11-cr01.bessems.eu/proxy/library/node:20-slim + pull: always + commands: + - | + apt-get update + - | + apt-get install -y --no-install-recommends \ + curl \ + git-core \ + jq \ + ca-certificates + - | + curl -L https://api.github.com/repos/mikefarah/yq/releases/latest | \ + jq -r '.assets[] | select(.name | endswith("yq_linux_amd64")) | .browser_download_url' | \ + xargs -I {} curl -L -o /bin/yq {} && \ + chmod +x /bin/yq + - | + npm install \ + semantic-release \ + @semantic-release/commit-analyzer \ + @semantic-release/exec \ + - | + export K8S_VERSION=$(yq '.components.clusterapi.workload.version.k8s' < ./ansible/vars/metacluster.yml) + export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY} + - | + npx semantic-release \ + --package @semantic-release/exec \ + --package semantic-release \ + --branches ${DRONE_BRANCH} \ + --tag-format "K8s_$${K8S_VERSION}-v\$${version}" \ + --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: Install Ansible Galaxy collections - # depends_on: - # - Linting image: bv11-cr01.bessems.eu/library/packer-extended pull: always commands: @@ -42,13 +84,8 @@ steps: 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: @@ -57,6 +94,7 @@ steps: packer/preseed/UbuntuServer22.04/user-data - | export K8S_VERSION=$(yq '.components.clusterapi.workload.version.k8s' < ./ansible/vars/metacluster.yml) + export APPLIANCE_VERSION=$(cat .version) - | packer init -upgrade \ ./packer @@ -71,6 +109,7 @@ steps: -var ssh_password=$${SSH_PASSWORD} \ -var vsphere_password=$${VSPHERE_PASSWORD} \ -var k8s_version=$K8S_VERSION \ + -var appliance_version=$APPLIANCE_VERSION \ ./packer - | packer build \ @@ -84,6 +123,7 @@ steps: -var ssh_password=$${SSH_PASSWORD} \ -var vsphere_password=$${VSPHERE_PASSWORD} \ -var k8s_version=$K8S_VERSION \ + -var appliance_version=$APPLIANCE_VERSION \ ./packer environment: DOCKER_USERNAME: @@ -106,8 +146,6 @@ steps: path: /scratch - name: Kubernetes Upgrade Appliance - # depends_on: - # - Install Ansible Galaxy collections image: bv11-cr01.bessems.eu/library/packer-extended pull: alwaysquery( commands: @@ -116,6 +154,7 @@ steps: packer/preseed/UbuntuServer22.04/user-data - | export K8S_VERSION=$(yq '.components.clusterapi.workload.version.k8s' < ./ansible/vars/metacluster.yml) + export APPLIANCE_VERSION=$(cat .version) - | packer init -upgrade \ ./packer @@ -130,6 +169,7 @@ steps: -var ssh_password=$${SSH_PASSWORD} \ -var vsphere_password=$${VSPHERE_PASSWORD} \ -var k8s_version=$K8S_VERSION \ + -var appliance_version=$APPLIANCE_VERSION \ ./packer - | packer build \ @@ -143,6 +183,7 @@ steps: -var ssh_password=$${SSH_PASSWORD} \ -var vsphere_password=$${VSPHERE_PASSWORD} \ -var k8s_version=$K8S_VERSION \ + -var appliance_version=$APPLIANCE_VERSION \ ./packer environment: DOCKER_USERNAME: @@ -165,9 +206,6 @@ steps: path: /scratch - name: Remove temporary resources - # depends_on: - # - Kubernetes Bootstrap Appliance - # - Kubernetes Upgrade Appliance image: bv11-cr01.bessems.eu/library/packer-extended commands: - | diff --git a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/filter_plugins/netaddr.py b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/filter_plugins/netaddr.py deleted file mode 100644 index cc788ef..0000000 --- a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/filter_plugins/netaddr.py +++ /dev/null @@ -1,14 +0,0 @@ -import netaddr - -def netaddr_iter_iprange(ip_start, ip_end): - return [str(ip) for ip in netaddr.iter_iprange(ip_start, ip_end)] - -class FilterModule(object): - ''' Ansible filter. Interface to netaddr methods. - https://pypi.org/project/netaddr/ - ''' - - def filters(self): - return { - 'netaddr_iter_iprange': netaddr_iter_iprange - } \ No newline at end of file diff --git a/ansible/vars/metacluster.yml b/ansible/vars/metacluster.yml index 2a39245..f028f7c 100644 --- a/ansible/vars/metacluster.yml +++ b/ansible/vars/metacluster.yml @@ -117,7 +117,7 @@ components: infrastructure_vsphere: v1.6.0 ipam_incluster: v0.1.0-alpha.2 # Refer to `https://console.cloud.google.com/gcr/images/cloud-provider-vsphere/GLOBAL/cpi/release/manager` for available tags - cpi_vsphere: v1.26.1 + cpi_vsphere: v1.26.2 workload: version: calico: v3.25.0 diff --git a/packer/build.pkr.hcl b/packer/build.pkr.hcl index cf277a8..55dbaed 100644 --- a/packer/build.pkr.hcl +++ b/packer/build.pkr.hcl @@ -46,7 +46,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.appliance_version}+${var.k8s_version}-${source.name}.ova" ] } }