From 1477151fffbfad2844f9eb74329baeaca8fb03d7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 17 Oct 2023 15:35:35 +0200 Subject: [PATCH] chore(deps): update non-minor dependencies (#25) * chore(deps): update non-minor dependencies * Drop support for GitLab-CI * Update Golang suggested by Renovate --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: i567000 --- .gitlab-ci.yml | 137 -------------------------------------------- Dockerfile | 2 +- ci/build_binaries | 14 ----- ci/build_image | 18 ------ ci/build_package | 11 ---- ci/gitlab_release | 62 -------------------- ci/upload_package | 3 - ci/validate_version | 26 --------- go.mod | 2 +- 9 files changed, 2 insertions(+), 273 deletions(-) delete mode 100644 .gitlab-ci.yml delete mode 100755 ci/build_binaries delete mode 100755 ci/build_image delete mode 100755 ci/build_package delete mode 100755 ci/gitlab_release delete mode 100755 ci/upload_package delete mode 100755 ci/validate_version diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index aefd090..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,137 +0,0 @@ -stages: - - validate - - binaries - - packages - - upload - - announce - -.release: - only: - - tags - except: - - master - -.build_package: - stage: packages - extends: - - .release - script: - - ci/build_package - needs: - - build:binaries - artifacts: - paths: - - .result/ - expire_in: 30m - -.upload_package: - stage: upload - extends: - - .release - image: registry.gitlab.com/alxrem/package_cloud - script: - - ci/upload_package - -validate: - stage: validate - image: alpine - extends: - - .release - script: - - apk -U add git - - ci/validate_version - -build:image: - stage: packages - image: docker:latest - services: - - docker:19.03.5-dind - except: - - master - script: - - ci/build_image - -build:binaries: - stage: binaries - extends: - - .release - image: golang:1.13-alpine - script: - - apk add -U binutils - - ci/build_binaries - artifacts: - paths: - - binaries/ - expire_in: 30m - -build:stretch: - extends: - - .build_package - image: debian:stretch - -upload:stretch: - variables: - DIST: debian/stretch - extends: - - .upload_package - needs: - - build:stretch - -build:buster: - extends: - - .build_package - image: debian:buster - -upload:buster: - variables: - DIST: debian/buster - extends: - - .upload_package - needs: - - build:buster - -build:xenial: - extends: - - .build_package - image: ubuntu:xenial - -upload:xenial: - variables: - DIST: ubuntu/xenial - extends: - - .upload_package - needs: - - build:xenial - -build:bionic: - extends: - - .build_package - image: ubuntu:bionic - -upload:bionic: - variables: - DIST: ubuntu/bionic - extends: - - .upload_package - needs: - - build:bionic - -announce: - stage: announce - extends: - - .release - image: python:3-alpine - needs: - - build:binaries - - job: upload:stretch - artifacts: false - - job: upload:buster - artifacts: false - - job: upload:xenial - artifacts: false - - job: upload:bionic - artifacts: false - script: - - pip install requests - - apk -U add git - - ci/gitlab_release diff --git a/Dockerfile b/Dockerfile index ddfa6c3..1715379 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.0-alpine AS builder +FROM golang:1.21.3-alpine AS builder WORKDIR /src/ COPY go.mod go.mod COPY go.sum go.sum diff --git a/ci/build_binaries b/ci/build_binaries deleted file mode 100755 index cd4e450..0000000 --- a/ci/build_binaries +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -DEST=`pwd`/binaries -GOARCH=amd64 - -mkdir -p ${DEST}/ - -for GOOS in windows linux darwin; do - BINARY="${DEST}/${CI_PROJECT_NAME}-${CI_COMMIT_TAG}-${GOOS}-${GOARCH}" - SUM="${BINARY}.sha256" - CGO_ENABLED=0 go build -o $BINARY - strip $BINARY - sha256sum $BINARY | sed -e 's|\(\w\+\s\+\).*/\(.*\)$|\1\2|' > $SUM -done diff --git a/ci/build_image b/ci/build_image deleted file mode 100755 index 9d19392..0000000 --- a/ci/build_image +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -TAG=${CI_COMMIT_TAG:-$CI_COMMIT_REF_SLUG} -docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY -docker build -t $CI_REGISTRY_IMAGE:$TAG . -docker push $REPO_NAME:$TAG - -if [ -n "$CI_COMMIT_TAG" ]; then - docker tag $CI_REGISTRY_IMAGE:$TAG $CI_REGISTRY_IMAGE:latest - docker push $CI_REGISTRY_IMAGE:latest - - docker login -u $DOCKERHUB_USER -p $DOCKERHUB_TOKEN - docker tag $CI_REGISTRY_IMAGE:$TAG alxrem/prometheus-logstash-exporter:$TAG - docker push alxrem/prometheus-logstash-exporter:$TAG - - docker tag $CI_REGISTRY_IMAGE:$TAG alxrem/prometheus-logstash-exporter:latest - docker push alxrem/prometheus-logstash-exporter:latest -fi diff --git a/ci/build_package b/ci/build_package deleted file mode 100755 index ca58209..0000000 --- a/ci/build_package +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -apt-get -qq update -apt-get -qq --no-install-recommends install devscripts equivs - -rm -f Makefile -mk-build-deps -irBt "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -qq -y" -dpkg-buildpackage -uc -us -rm -rf .result && mkdir -p .result -find ../ -maxdepth 1 -type f -exec mv '{}' .result/ ';' -find .result/ diff --git a/ci/gitlab_release b/ci/gitlab_release deleted file mode 100755 index f3e2116..0000000 --- a/ci/gitlab_release +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python3 - -import os -import subprocess -from glob import glob -from urllib.parse import urljoin - -import requests - - -def do_release(): - gitlab_token = os.environ["GITLAB_TOKEN"] - version = os.environ["CI_COMMIT_TAG"] - project = os.environ["CI_PROJECT_ID"] - project_url = os.environ["CI_PROJECT_URL"] - headers = {"PRIVATE-TOKEN": gitlab_token} - - # https://docs.gitlab.com/ee/api/projects.html#upload-a-file - uploads_url = \ - "https://gitlab.com/api/v4/projects/{}/uploads".format(project) - - # https://docs.gitlab.com/ee/api/releases/#create-a-release - release_url = \ - "https://gitlab.com/api/v4/projects/{}/releases".format(project) - - binaries = [] - assets_links = [] - for binary in glob("binaries/*"): - files = {"file": open(binary, "rb")} - - r = requests.post(uploads_url, headers=headers, files=files) - if r.status_code >= 400: - print(r.text) - exit(1) - - upload = r.json() - binaries.append(upload["markdown"]) - assets_links.append({ - 'name': upload['alt'], - 'url': urljoin(project_url + '/', upload['url'].lstrip('/')), - }) - - description = \ - subprocess.getoutput("git tag {} -l --format='%(contents:body)'" - .format(version)) - - release = { - "name": version, - "tag_name": version, - "description": description, - 'assets': { - 'links': sorted(assets_links, key=lambda x: x['name'], reverse=True), - } - } - r = requests.post(release_url, headers=headers, json=release) - if r.status_code >= 400: - print(r.text) - exit(1) - - -if __name__ == "__main__": - do_release() diff --git a/ci/upload_package b/ci/upload_package deleted file mode 100755 index fcce1f6..0000000 --- a/ci/upload_package +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -package_cloud push alxrem/prometheus-logstash-exporter/$DIST .result/*.deb \ No newline at end of file diff --git a/ci/validate_version b/ci/validate_version deleted file mode 100755 index 0e1f2ce..0000000 --- a/ci/validate_version +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -SANITIZED_VERSION=$(echo "$CI_COMMIT_TAG" | egrep -ox '[0-9]+\.[0-9]+\.[0-9]+.*') - -if [ -z "$SANITIZED_VERSION" ]; then - echo "Invalid version format \"$CI_COMMIT_TAG\"" - exit 1 -fi - -ANNOTATION=$(git tag $CI_COMMIT_TAG -l --format='%(contents:body)' | tr -d '[[:space:]]') -if [ -z "$ANNOTATION" ]; then - echo "Tag should by annotated" - exit 1 -fi - -CHANGELOG_EXPECTED="prometheus-logstash-exporter ($CI_COMMIT_TAG)" -CHANGELOG_FOUND=$(head -n1 debian/changelog | fgrep -o "$CHANGELOG_EXPECTED") - -if [ "$CHANGELOG_FOUND" != "$CHANGELOG_EXPECTED" ]; then - echo "Version $CHANGELOG_EXPECTED expected" - echo - echo "Found $(head -n1 debian/changelog)" - exit 1 -fi - -exit 0 diff --git a/go.mod b/go.mod index 08f52a7..010c14d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/sap-contributions/prometheus-logstash-exporter -go 1.21 +go 1.21.3 require github.com/prometheus/client_golang v1.16.0