Skip to content

Commit

Permalink
optimize release workflow
Browse files Browse the repository at this point in the history
- use explicity the specified version
- Combine the release process in a single job
  • Loading branch information
Marc Schöchlin committed Jan 5, 2025
1 parent 162212c commit ccf59ff
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 48 deletions.
22 changes: 9 additions & 13 deletions .github/workflows/shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
type: boolean

jobs:
build-pkg:
build-and-release:
name: CI-PKGs
runs-on: ubuntu-latest
steps:
Expand All @@ -26,28 +26,24 @@ jobs:
run: ./create_packages
- name: Test Package
run: sudo ./ci_test
- uses: ncipollo/release-action@v1
if: ${{ inputs.publish_steps }}
with:
artifacts: "zabbix-agent-extensions*.deb,zabbix-agent-extensions-*.rpm"
build-docker:
name: CI-Docker
runs-on: ubuntu-latest
environment: "Docker Upload"
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build Docker Image
run: |
./create_docker build
# Publish release
- uses: ncipollo/release-action@v1
if: ${{ inputs.publish_steps }}
with:
artifacts: "zabbix-agent-extensions*.deb,zabbix-agent-extensions-*.rpm"
- name: Login to Docker Hub
if: ${{ inputs.publish_steps }}
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build
run: |
./create_docker build
- name: Publish docker images
if: ${{ inputs.publish_steps }}
run: |
Expand Down
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
FROM zabbix/zabbix-agent:ubuntu-7.2-latest

ARG BUILD_DATE
ARG BUILD_VERSION

USER 0
ADD /docker-scripts /tmp/setup
RUN chmod 755 /tmp/setup/*.sh
Expand Down
5 changes: 4 additions & 1 deletion create_docker
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ buildDocker(){
set -x
docker rmi ${IMAGE_NAME}:${VERSION}
set -e
docker build --progress plain --build-arg BUILD_DATE="$(date "+%Y-%m-%d")" -t ${IMAGE_NAME}:${VERSION} -f Dockerfile .
docker build --progress plain \
--build-arg BUILD_DATE="$(date "+%Y-%m-%d")" \
--build-arg BUILD_VERSION="$VERSION" \
-t ${IMAGE_NAME}:${VERSION} -f Dockerfile .
set +xe
}

Expand Down
3 changes: 2 additions & 1 deletion docker-scripts/04_install_agent_extensions.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

set -xe
cd /tmp/setup
ls -l /tmp/setup
dpkg -i *.deb
dpkg -i "zabbix-agent-extensions_${BUILD_VERSION?The version of the extension}_all.deb"
sed -i '~s,/var/lib/zabbix/:/sbin/nologin,/var/lib/zabbix/:/bin/bash,' /etc/passwd

0 comments on commit ccf59ff

Please sign in to comment.