[pkg-nagios-changes] [Git][nagios-team/pkg-monitoring-plugins][master] 4 commits: Adding github actions

Jan Wagner (@waja) gitlab at salsa.debian.org
Sat Nov 5 10:24:39 GMT 2022



Jan Wagner pushed to branch master at Debian Nagios Maintainer Group / pkg-monitoring-plugins


Commits:
2a90f45f by Jan Wagner at 2022-11-03T12:43:24+00:00
Adding github actions

- - - - -
7d0e34a2 by Jan Wagner at 2022-11-03T12:43:24+00:00
Use testing, since unstable has large transition ongoing

- - - - -
0543e439 by Jan Wagner at 2022-11-03T12:43:24+00:00
only removing github stuff

- - - - -
1e0e230b by Jan Wagner at 2022-11-05T10:10:14+00:00
Adding d/patches/16_check_pgsql_dbname_too_strict (Closes: ##982847)

- - - - -


5 changed files:

- + .github/dependabot.yml
- + .github/workflows/packaging_test.yml
- + .github/workflows/release.yml
- + debian/patches/16_check_pgsql_dbname_too_strict
- debian/patches/series


Changes:

=====================================
.github/dependabot.yml
=====================================
@@ -0,0 +1,12 @@
+version: 2
+updates:
+  - package-ecosystem: github-actions
+    directory: "/"
+    schedule:
+      interval: daily
+      time: "04:00"
+    reviewers:
+      - "waja"
+    pull-request-branch-name:
+      separator: "-"
+    open-pull-requests-limit: 10


=====================================
.github/workflows/packaging_test.yml
=====================================
@@ -0,0 +1,36 @@
+name: Packaging Test
+
+on:
+  push:
+    branches:
+      - $default-branch
+      - development
+      - master
+  # Run tests for any PRs
+  pull_request:
+
+env:
+  SOURCE_DIR: ./
+  ARTIFACTS_DIR: debian/build/release/
+
+jobs:
+  test:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout at v3
+      env:
+        DEBIAN_FRONTEND: "noninteractive"
+    - name: Remove github artefacts
+      run: |
+        rm -rf .github*
+    - name: Adjust distibution in changelog file
+      run: |
+        sed -i '0,/restricted/s//stable/' debian/changelog
+    - name: Build Debian package
+      uses: dawidd6/action-debian-package at v1.4.0
+      with:
+        artifacts_directory: debian/build/release/
+        os_distribution: testing
+    - name: Debug
+      run: |
+        ls -la


=====================================
.github/workflows/release.yml
=====================================
@@ -0,0 +1,71 @@
+on:
+  push:
+    # Sequence of patterns matched against refs/tags
+    tags:
+      - 'debian/*' # Push events to matching debian/*, i.e. debian/1.0-2, debian/20.15.10, debian/23.20020326
+
+name: Release Process
+
+env:
+  SOURCE_DIR: ./
+  ARTIFACTS_DIR: debian/build/release/
+
+jobs:
+  create-release:
+    name: Create Release
+    runs-on: ubuntu-latest
+    outputs:
+      release-id: ${{ steps.create_release.outputs.id }}
+    steps:
+      - name: Checkout code
+        uses: actions/checkout at v3
+      - name: Install needed packages
+        run: |
+          if [ $(dpkg -l | grep -c dpkg-dev) -ne 1 ]; then sudo apt-get update && sudo apt-get install -y dpkg-dev; fi
+      - name: Gather changelog
+        run: |
+          ls -la
+          dpkg-parsechangelog | tail -n +9 > debian.changelog
+      - name: Create Release
+        id: create_release
+        uses: actions/create-release at v1
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
+        with:
+          tag_name: ${{ github.ref }}
+          release_name: Release ${{ github.ref }}
+          body_path: debian.changelog
+          draft: false
+          prerelease: false
+
+  build:
+    name: Build and upload packages
+    needs: create-release
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout at v3
+      env:
+        DEBIAN_FRONTEND: "noninteractive"
+    - name: Remove github artefacts
+      run: |
+        rm -rf .github*
+    - name: Adjust distibution in changelog file
+      run: |
+        sed -i '0,/restricted/s//stable/' debian/changelog
+    - name: Build Debian package
+      uses: dawidd6/action-debian-package at v1.4.0
+      with:
+        artifacts_directory: debian/build/release/
+        os_distribution: testing
+#    - name: Build Debian package
+#      uses: pi-top/action-debian-package at v0.2.0
+#      with:
+#        artifacts_directory: debian/build/release/
+#        target_architectures: "amd64,i386"
+    - name: Upload the artifacts
+      uses: skx/github-action-publish-binaries at release-2.0
+      env:
+        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      with:
+        releaseId: ${{ needs.create-release.outputs.release-id }}
+        args: debian/build/release/*


=====================================
debian/patches/16_check_pgsql_dbname_too_strict
=====================================
@@ -0,0 +1,88 @@
+From 508f8e875210ec140457d58463589626a761bb2e Mon Sep 17 00:00:00 2001
+From: Florian Lohoff <f at zz.de>
+Date: Mon, 15 Feb 2021 15:26:33 +0100
+Subject: [PATCH] Removing is_pg_dbname alltogether,using postgres API.
+ (Closes: #1660)
+
+The problem is that check_pgsql validates the Database name and has different assumptions
+that postgres itself.
+
+I fail to see a reason to validate the database name here. Postgres'es API should
+do this - So i would suggest a fix like this by removing is_pg_dbname alltogether.
+---
+ plugins/check_pgsql.c | 48 ++++---------------------------------------
+ 1 file changed, 4 insertions(+), 44 deletions(-)
+
+diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c
+index c893386cb..c26cd439c 100644
+--- a/plugins/check_pgsql.c
++++ b/plugins/check_pgsql.c
+@@ -69,7 +69,6 @@ int process_arguments (int, char **);
+ int validate_arguments (void);
+ void print_usage (void);
+ void print_help (void);
+-int is_pg_dbname (char *);
+ int is_pg_logname (char *);
+ int do_query (PGconn *, char *);
+ 
+@@ -347,10 +346,10 @@ process_arguments (int argc, char **argv)
+ 				pgport = optarg;
+ 			break;
+ 		case 'd':     /* database name */
+-			if (!is_pg_dbname (optarg)) /* checks length and valid chars */
+-				usage2 (_("Database name is not valid"), optarg);
+-			else /* we know length, and know optarg is terminated, so us strcpy */
+-				snprintf(dbName, NAMEDATALEN, "%s", optarg);
++			if (strlen(optarg) >= NAMEDATALEN) {
++				usage2 (_("Database name exceeds the maximum length"), optarg);
++			}
++			snprintf(dbName, NAMEDATALEN, "%s", optarg);
+ 			break;
+ 		case 'l':     /* login name */
+ 			if (!is_pg_logname (optarg))
+@@ -414,45 +413,6 @@ validate_arguments ()
+ 	return OK;
+ }
+ 
+-
+-/******************************************************************************
+-
+-@@-
+-<sect3>
+-<title>is_pg_dbname</title>
+-
+-<para>&PROTO_is_pg_dbname;</para>
+-
+-<para>Given a database name, this function returns TRUE if the string
+-is a valid PostgreSQL database name, and returns false if it is
+-not.</para>
+-
+-<para>Valid PostgreSQL database names are less than &NAMEDATALEN;
+-characters long and consist of letters, numbers, and underscores. The
+-first character cannot be a number, however.</para>
+-
+-</sect3>
+--@@
+-******************************************************************************/
+-
+-
+-
+-int
+-is_pg_dbname (char *dbname)
+-{
+-	char txt[NAMEDATALEN];
+-	char tmp[NAMEDATALEN];
+-	if (strlen (dbname) > NAMEDATALEN - 1)
+-		return (FALSE);
+-	strncpy (txt, dbname, NAMEDATALEN - 1);
+-	txt[NAMEDATALEN - 1] = 0;
+-	if (sscanf (txt, "%[_a-zA-Z]%[^_a-zA-Z0-9-]", tmp, tmp) == 1)
+-		return (TRUE);
+-	if (sscanf (txt, "%[_a-zA-Z]%[_a-zA-Z0-9-]%[^_a-zA-Z0-9-]", tmp, tmp, tmp) ==
+-			2) return (TRUE);
+-	return (FALSE);
+-}
+-
+ /**
+ 
+ the tango program should eventually create an entity here based on the


=====================================
debian/patches/series
=====================================
@@ -4,3 +4,4 @@
 13_check_http_fix_superflous_crlf
 14_PRId64_PRIu64_1
 15_PRId64_PRIu64_2
+16_check_pgsql_dbname_too_strict



View it on GitLab: https://salsa.debian.org/nagios-team/pkg-monitoring-plugins/-/compare/5a11a70409ee744454ff311d7ed5ea326c0c2ee7...1e0e230bb2a104e31ebf8c85a9424b50009910d9

-- 
View it on GitLab: https://salsa.debian.org/nagios-team/pkg-monitoring-plugins/-/compare/5a11a70409ee744454ff311d7ed5ea326c0c2ee7...1e0e230bb2a104e31ebf8c85a9424b50009910d9
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-nagios-changes/attachments/20221105/77d6249d/attachment-0001.htm>


More information about the pkg-nagios-changes mailing list