From 3dc95fef7e56fcaa82ecb426f1879cbb81d05e05 Mon Sep 17 00:00:00 2001 From: Vladimir Ermakov Date: Fri, 6 Dec 2024 13:28:48 +0100 Subject: [PATCH 1/2] heat: update to use OCI plugin image, flatcar 4081.2.0 --- README.md | 5 +- heat/gitlab-runner-plugin-prepare.service | 14 ------ heat/gitlab-runner.service | 22 +++++---- heat/manager.bu.yml | 9 ---- heat/stack.yaml | 56 ++++++++--------------- 5 files changed, 35 insertions(+), 71 deletions(-) delete mode 100644 heat/gitlab-runner-plugin-prepare.service diff --git a/README.md b/README.md index ad9f6cb..137d0f4 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,10 @@ pull_policy = ["always", "always"] capacity_per_instance = 1 max_use_count = 10 max_instances = 16 -plugin = "fleeting-plugin-openstack" +# NOTE: If you manually download plugin and place it into your PATH: +# plugin = "fleeting-plugin-openstack" +# Or just run `gitlab-runner fleeting install` and it'll download OCI image automatically. +plugin = "ghcr.io/sardinasystems/fleeting-plugin-openstack:latest" [runners.autoscaler.plugin_config] cloud = "runner" diff --git a/heat/gitlab-runner-plugin-prepare.service b/heat/gitlab-runner-plugin-prepare.service deleted file mode 100644 index 6a15dc1..0000000 --- a/heat/gitlab-runner-plugin-prepare.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=GitLab Runner plugin prepare -ConditionFileIsExecutable=!/opt/bin/fleeting-plugin-openstack -ConditionPathExists=/opt/fleeting-plugin-openstack.tar.gz - -[Service] -Type=oneshot -RemainAfterExit=true -Restart=on-failure -ExecStartPre=/usr/bin/tar -v --extract --file /opt/fleeting-plugin-openstack.tar.gz -C /opt -ExecStart=/usr/bin/rm /opt/fleeting-plugin-openstack.tar.gz - -[Install] -WantedBy=multi-user.target diff --git a/heat/gitlab-runner.service b/heat/gitlab-runner.service index adb2ab9..5a032b2 100644 --- a/heat/gitlab-runner.service +++ b/heat/gitlab-runner.service @@ -1,25 +1,27 @@ [Unit] Description=GitLab Runner ConditionFileNotEmpty=/etc/gitlab-runner/config.toml -ConditionFileIsExecutable=/opt/bin/fleeting-plugin-openstack -After=network-online.target docker.service gitlab-runner-plugin-prepare.service +After=network-online.target docker.service Wants=network-online.target -Requires=docker.service gitlab-runner-plugin-prepare.service +Requires=docker.service [Service] Environment=IMAGE=$RUNNER_IMAGE EnvironmentFile=-/etc/sysconfig/gitlab-runner -#ExecStartPre=/usr/bin/docker pull $IMAGE ExecStartPre=-/usr/bin/docker rm --force gitlab-runner -ExecStart=/usr/bin/docker run --name gitlab-runner --pull always --network=host --ipc=host \ +ExecStartPre=-/usr/bin/docker volume create plugins +ExecStartPre=/usr/bin/docker run --rm --name gitlab-runner-plugin-install --pull always --network=host --ipc=host \ -v /etc/gitlab-runner:/etc/gitlab-runner \ -v /var/run/docker.sock:/var/run/docker.sock \ - -v /opt/bin:/usr/local/bin \ + -v plugins:/root/.config/fleeting/plugins \ + $IMAGE fleeting install +ExecStart=/usr/bin/docker run --name gitlab-runner --network=host --ipc=host \ + -v /etc/gitlab-runner:/etc/gitlab-runner \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v plugins:/root/.config/fleeting/plugins \ $IMAGE - ExecStop=/usr/bin/docker stop gitlab-runner -#ExecStopPost=/usr/bin/docker rm gitlab-runner StartLimitInterval=5 StartLimitBurst=10 @@ -27,8 +29,8 @@ StartLimitBurst=10 Restart=always RestartSec=120 -#StandardOutput=journal+console -#StandardError=inherit +# StandardOutput=journal+console +# StandardError=inherit [Install] WantedBy=multi-user.target diff --git a/heat/manager.bu.yml b/heat/manager.bu.yml index 9c1ea21..58775ed 100644 --- a/heat/manager.bu.yml +++ b/heat/manager.bu.yml @@ -4,11 +4,6 @@ version: 1.1.0 storage: files: - - path: /opt/fleeting-plugin-openstack.tar.gz - mode: 0644 - contents: - source: "https://github.com/sardinasystems/fleeting-plugin-openstack/releases/download/$PLUGINVERSION/fleeting-plugin-openstack_$PLUGINVERSION_linux_amd64.tar.gz" - # NOTE: By default flatcar creates two default routes, which sometimes makes node inaccessible. # That drop-in disables unneded routes on internal runner network. - path: /etc/systemd/network/20-eth1.network @@ -21,10 +16,6 @@ storage: systemd: units: - - name: gitlab-runner-plugin-prepare.service - enabled: true - contents_local: gitlab-runner-plugin-prepare.service - - name: gitlab-runner.service enabled: true contents_local: gitlab-runner.service diff --git a/heat/stack.yaml b/heat/stack.yaml index 9758ace..802883d 100644 --- a/heat/stack.yaml +++ b/heat/stack.yaml @@ -83,15 +83,10 @@ parameters: # constraints: # XXX(vermakov): works only for strings # - custom_constraint: ip_addr - plugin_version: - type: string - label: Fleeting plugin version tag - default: 0.21.1 - gitlab_runner_image: type: string label: Gitlab runner image - default: gitlab/gitlab-runner:alpine + default: gitlab/gitlab-runner:latest conditions: public_ipv6_enabled: @@ -271,12 +266,12 @@ resources: name: {list_join: ['-', ['flatcar', {get_param: 'OS::stack_name'}, {get_param: 'OS::stack_id'}]]} container_format: bare disk_format: qcow2 - location: "https://repo.geo.sardinasystems.com/mirror/images/flatcar_production_openstack_3815.2.5_amd64.img" + location: "https://repo.geo.sardinasystems.com/mirror/images/flatcar_production_openstack_4081.2.0_amd64.img" architecture: x86_64 min_disk: 10 min_ram: 4096 os_distro: flatcar - os_version: '3815.2.5' + os_version: '4081.2.0' extra_properties: hw_qemu_guest_agent: 'yes' # hw_firmware_type: uefi @@ -284,7 +279,10 @@ resources: # hw_watchdog_action: reset os_admin_user: core os_type: linux - + # precalculated checksum from index.yml + # os_hash_algo: sha256 + # os_hash_value: 2c3616725bb6335c784883477258be97cab74c84dabef6786dc1776eb82719f0 + owner_specified.openstack.sha256: 2c3616725bb6335c784883477258be97cab74c84dabef6786dc1776eb82719f0 tags: [Gitlab, CI, Flatcar] protected: false @@ -346,59 +344,43 @@ resources: - path: /etc/gitlab-runner mode: 448 files: - - path: /opt/fleeting-plugin-openstack.tar.gz - contents: - source: - str_replace: - template: "https://github.com/sardinasystems/fleeting-plugin-openstack/releases/download/$PLUGINVERSION/fleeting-plugin-openstack_$PLUGINVERSION_linux_amd64.tar.gz" - params: - $PLUGINVERSION: {get_param: plugin_version} - mode: 420 - path: /etc/systemd/network/20-eth1.network contents: compression: "" source: data:,%5BMatch%5D%0AName%3Deth1%0A%0A%5BNetwork%5D%0ADHCP%3Dipv4%0A%0A%5BDHCP%5D%0AUseRoutes%3Dfalse%0AUseGateway%3Dfalse%0ARouteMetric%3D2000%0A systemd: units: - - contents: | - [Unit] - Description=GitLab Runner plugin prepare - ConditionFileIsExecutable=!/opt/bin/fleeting-plugin-openstack - ConditionPathExists=/opt/fleeting-plugin-openstack.tar.gz - [Service] - Type=oneshot - RemainAfterExit=true - Restart=on-failure - ExecStartPre=/usr/bin/tar -v --extract --file /opt/fleeting-plugin-openstack.tar.gz -C /opt - ExecStart=/usr/bin/rm /opt/fleeting-plugin-openstack.tar.gz - [Install] - WantedBy=multi-user.target - enabled: true - name: gitlab-runner-plugin-prepare.service - contents: str_replace: template: | [Unit] Description=GitLab Runner ConditionFileNotEmpty=/etc/gitlab-runner/config.toml - ConditionFileIsExecutable=/opt/bin/fleeting-plugin-openstack - After=network-online.target docker.service gitlab-runner-plugin-prepare.service + After=network-online.target docker.service Wants=network-online.target - Requires=docker.service gitlab-runner-plugin-prepare.service + Requires=docker.service [Service] Environment=IMAGE=$RUNNER_IMAGE EnvironmentFile=-/etc/sysconfig/gitlab-runner ExecStartPre=-/usr/bin/docker rm --force gitlab-runner - ExecStart=/usr/bin/docker run --name gitlab-runner --pull always --network=host --ipc=host \ + ExecStartPre=-/usr/bin/docker volume create plugins + ExecStartPre=/usr/bin/docker run --rm --name gitlab-runner-plugin-install --pull always --network=host --ipc=host \ + -v /etc/gitlab-runner:/etc/gitlab-runner \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v plugins:/root/.config/fleeting/plugins \ + $IMAGE fleeting install + ExecStart=/usr/bin/docker run --name gitlab-runner --network=host --ipc=host \ -v /etc/gitlab-runner:/etc/gitlab-runner \ -v /var/run/docker.sock:/var/run/docker.sock \ - -v /opt/bin:/usr/local/bin \ + -v plugins:/root/.config/fleeting/plugins \ $IMAGE ExecStop=/usr/bin/docker stop gitlab-runner StartLimitInterval=5 StartLimitBurst=10 Restart=always RestartSec=120 + # StandardOutput=journal+console + # StandardError=inherit [Install] WantedBy=multi-user.target params: From c7725822b220aaf82c746758d0e70b43cd6e0c75 Mon Sep 17 00:00:00 2001 From: Vladimir Ermakov Date: Fri, 6 Dec 2024 13:47:38 +0100 Subject: [PATCH 2/2] readme: add hint about fastzip --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 137d0f4..da5d015 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,11 @@ executor = "docker-autoscaler" output_limit = 10240 shell = "bash" environment = [ - "FF_NETWORK_PER_BUILD=1" + "FF_NETWORK_PER_BUILD=1", + "FF_USE_FASTZIP=1", + "ARTIFACT_COMPRESSION_LEVEL=default", + "CACHE_COMPRESSION_LEVEL=fastest", + "FASTZIP_ARCHIVER_BUFFER_SIZE=67108864" ] [runners.cache]