Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .github/workflows/container-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Build Container Image

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
push:
branches: [ "main" ]
# Publish semver tags as releases.
tags: [ '*.*.*' ]
pull_request:
branches: [ "main" ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/[email protected]
with:
cosign-release: 'v2.2.3'

# Set up QEMU to be able to build to multiple architectures
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/[email protected]

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/[email protected]
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64


# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
COSIGN_EXPERIMENTAL: "true"
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign --yes {}@${{ steps.build-and-push.outputs.digest }}
36 changes: 0 additions & 36 deletions .github/workflows/docker-push.yml

This file was deleted.

67 changes: 34 additions & 33 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ jobs:

strategy:
matrix:
python-version: [3.7]
python-version: [3.13]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4.2.2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5.4.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -41,44 +41,45 @@ jobs:
- name: Test with pytest
run: |
pytest --cov=. -v tests/unit
- uses: codecov/codecov-action@v1
- name: integration tests
run: |
pytest tests/integration
- name: Setup ruby env
uses: actions/setup-ruby@v1
uses: ruby/setup-ruby@v1.227.0
with:
ruby-version: 2.7
- run: |
gem install pre-commit-sign
export COMMIT_MESSAGE=$(git log -1)
ruby validate-signature.rb "${COMMIT_MESSAGE}"

deploy:
strategy:
matrix:
python-version: [3.7]

runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}

steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_TOKEN }}
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: install semantic-release
run: |
pip install python-semantic-release
- name: deploy pip
run: |
git config --global user.name "semantic-release (via github actions)"
git config --global user.email "semantic-release@github-actions"
semantic-release publish
env: # Or as an environment variable
GH_TOKEN: ${{ secrets.GH_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
# Deactivated pypi publishing until adoption process is done
#
# deploy:
# strategy:
# matrix:
# python-version: [3.7]
#
# runs-on: ubuntu-latest
# if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
#
# steps:
# - uses: actions/checkout@v2
# with:
# token: ${{ secrets.GH_TOKEN }}
# fetch-depth: 0
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.python-version }}
# - name: install semantic-release
# run: |
# pip install python-semantic-release
# - name: deploy pip
# run: |
# git config --global user.name "semantic-release (via github actions)"
# git config --global user.email "semantic-release@github-actions"
# semantic-release publish
# env: # Or as an environment variable
# GH_TOKEN: ${{ secrets.GH_TOKEN }}
# PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
38 changes: 21 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,53 +1,57 @@
default_install_hook_types: [pre-commit, commit-msg]
repos:
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.5.6 # Use the sha / tag you want to point at
- repo: https://github.com/hhatto/autopep8
rev: v2.3.2
hooks:
- id: autopep8
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.3.0
rev: v5.0.0
hooks:
# Git state
- id: check-merge-conflict
stages: [commit]
stages: [pre-commit]
- id: check-added-large-files
stages: [commit]
stages: [pre-commit]
# Sensitive information
- id: detect-private-key
stages: [commit]
stages: [pre-commit]
- id: detect-aws-credentials
stages: [commit]
stages: [pre-commit]
args:
- --allow-missing-credentials
# Generic file state
- id: trailing-whitespace
stages: [commit]
stages: [pre-commit]
- id: mixed-line-ending
stages: [commit]
stages: [pre-commit]
- id: end-of-file-fixer
stages: [commit]
stages: [pre-commit]
exclude: .*\.tfvars$ # terraform fmt separates everything with blank lines leaving a trailing line at the end
- id: check-executables-have-shebangs
stages: [commit]
stages: [pre-commit]
# Language syntax/formatting
- id: check-yaml
stages: [commit]
stages: [pre-commit]
- id: check-json
stages: [commit]
stages: [pre-commit]
- id: pretty-format-json
stages: [commit]
stages: [pre-commit]
args:
- --autofix
- repo: https://github.com/pycqa/flake8
rev: 7.1.2
hooks:
- id: flake8
stages: [commit]
stages: [pre-commit]
args:
- --ignore=F705,E123,E402
- repo: https://github.com/pryorda/dockerfilelint-precommit-hooks
rev: v0.1.0
hooks:
- id: dockerfilelint
stages: [commit]
stages: [pre-commit]
- repo: https://github.com/mattlqx/pre-commit-sign
rev: v1.1.3
rev: v1.2.0
hooks:
- id: sign-commit
stages: [commit-msg]
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-alpine
FROM python:3.13-alpine

LABEL MAINTAINER="Daniel Pryor <[email protected]>"
LABEL NAME=vmware_exporter
Expand Down
3 changes: 1 addition & 2 deletions requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pytest_docker_tools==0.2.0
pytest==5.4.1
pytest==6.2.5
pytest-cov==2.8.1
pytest-twisted==1.12
codecov==2.0.17
flake8>=3.6.0
pyflakes>=1.5.0
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
prometheus-client==0.0.19
pytz
pyvmomi>=6.5
twisted>=14.0.2
twisted==24.7.0
pyyaml>=5.1
service-identity
requests
Loading