-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from JamesJonesConsulting/release/3.1.0
Release/3.1.0
- Loading branch information
Showing
13 changed files
with
270 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ jobs: | |
build-job: | ||
runs-on: self-hosted | ||
container: | ||
image: registry.fedoraproject.org/fedora:latest | ||
image: quay.io/podman/stable:latest | ||
options: --userns=keep-id --privileged --user root | ||
steps: | ||
# Downloads a copy of the code in your repository before running CI tests | ||
|
@@ -16,8 +16,8 @@ jobs: | |
- name: Install RPM dependencies | ||
run: | | ||
dnf install -y rpm-build rpm-sign rubygems ruby-devel gcc gcc-c++ make \ | ||
libffi-devel python3 python3-pip python3-virtualenv | ||
# Sets up Rubygems packaging | ||
libffi-devel python3 python3-pip python3-virtualenv curl pinentry | ||
# Sets up Rubygems packaging pinentry-program /usr/bin/pinentry-curses | ||
- name: Setup FPM with it's dependent package for building a package | ||
run: | | ||
gem install ffi | ||
|
@@ -39,44 +39,73 @@ jobs: | |
VERSION=$GITHUB_REF_NAME | ||
else | ||
VERSION=$(./dist/voterwarehouse -v) | ||
VERSION+=$(echo "~${GITHUB_REF_NAME}" | sed 's|/|-|g') | ||
VERSION+=$(echo "~${GITHUB_REF_NAME}" | sed "s|/${VERSION}||g" | sed 's|/|-|g') | ||
fi | ||
echo "$VERSION" | ||
echo "$GITHUB_RUN_NUMBER" | ||
fpm -s dir -t rpm -n voterwarehouse -v ${VERSION} --iteration ${GITHUB_RUN_NUMBER} \ | ||
--description "VoterWarehouse: Imports and Extracts Voter and History data" \ | ||
--url "https://github.com/jamjon3/VoterWarehouse" \ | ||
--license "LGPL-3.0" --vendor "James Jones" \ | ||
--config-files /etc/VoterWarehouse/config.yml \ | ||
-p ./dist \ | ||
./dist/voterwarehouse=/usr/bin/voterwarehouse \ | ||
./config.sample.yml=/etc/VoterWarehouse/config.yml | ||
--description "VoterWarehouse: Imports and Extracts Voter and History data" \ | ||
--url "https://github.com/JamesJonesConsulting/VoterWarehouse" \ | ||
--license "LGPL-3.0" --vendor "James Jones" --maintainer "James Jones <[email protected]>" \ | ||
--config-files /etc/VoterWarehouse/config.yml \ | ||
-p ./dist \ | ||
./dist/voterwarehouse=/usr/bin/voterwarehouse \ | ||
./config.sample.yml=/etc/VoterWarehouse/config.yml | ||
PACKAGE_FILE=$(find . -type f -name "voterwarehouse*.rpm") | ||
package_cloud push $PACKAGE_CLOUD_REPO $PACKAGE_FILE | ||
rpm --import https://nexus.jamjon3.sytes.net/repository/gpg/RPM-GPG-KEY-JAMJON3 | ||
echo "${{ secrets.JAMJON3_RPM_SIGN_GPG_KEY }}" | base64 -d > key.gpg | ||
echo "${{ secrets.JAMJON3_RPM_SIGN_GPG_SECRET_KEY }}" | base64 -d > private.gpg | ||
export GPG_TTY=$(tty) | ||
gpg --import key.gpg | ||
echo '${{ secrets.JAMJON3_RPM_SIGN_PASSPHRASE }}' | gpg --batch --import private.gpg | ||
rpm --define "_gpg_name James Jones <[email protected]>" \ | ||
--define "_gpg_sign_cmd_extra_args --pinentry-mode loopback --passphrase ${{ secrets.JAMJON3_RPM_SIGN_PASSPHRASE }}" \ | ||
--addsign $PACKAGE_FILE | ||
curl -u "$YUM_USER:$YUM_PASSWORD" --upload-file $PACKAGE_FILE $NEXUS_YUM_REPO | ||
# package_cloud push $PACKAGE_CLOUD_REPO $PACKAGE_FILE | ||
shell: bash | ||
env: | ||
PACKAGE_CLOUD_REPO: jamjon3/yum/rpm_any/rpm_any | ||
YUM_USER: ${{ secrets.HOME_NEXUS_YUM_USER }} | ||
YUM_PASSWORD: ${{ secrets.HOME_NEXUS_YUM_PASSWORD }} | ||
NEXUS_YUM_REPO: https://nexus.jamjon3.sytes.net/repository/yum-hosted/voting/ | ||
- name: Build the DEB package | ||
run: | | ||
if [[ "$GITHUB_REF" =~ ^refs/tags.* ]]; then | ||
VERSION=$GITHUB_REF_NAME | ||
else | ||
VERSION=$(./dist/voterwarehouse -v) | ||
VERSION+=$(echo "~${GITHUB_REF_NAME}" | sed 's|/|-|g') | ||
# VERSION+=$(echo "~${GITHUB_REF_NAME}" | sed 's|/|-|g') | ||
VERSION+=$(echo "~${GITHUB_REF_NAME}" | sed "s|/${VERSION}||g" | sed 's|/|-|g') | ||
fi | ||
echo "$VERSION" | ||
echo "$GITHUB_RUN_NUMBER" | ||
fpm -s dir -t deb -n voterwarehouse -v ${VERSION} --iteration ${GITHUB_RUN_NUMBER} \ | ||
--description "VoterWarehouse: Imports and Extracts Voter and History data" \ | ||
--url "https://github.com/jamjon3/VoterWarehouse" \ | ||
--license "LGPL-3.0" --vendor "James Jones" \ | ||
--config-files /etc/VoterWarehouse/config.yml \ | ||
-p ./dist \ | ||
./dist/voterwarehouse=/usr/bin/voterwarehouse \ | ||
./config.sample.yml=/etc/VoterWarehouse/config.yml | ||
PACKAGE_FILE=$(find . -type f -name "voterwarehouse*.deb") | ||
package_cloud push $PACKAGE_CLOUD_REPO $PACKAGE_FILE | ||
--description "VoterWarehouse: Imports and Extracts Voter and History data" \ | ||
--url "https://github.com/jamjon3/VoterWarehouse" \ | ||
--license "LGPL-3.0" --vendor "James Jones" \ | ||
--config-files /etc/VoterWarehouse/config.yml \ | ||
-p ./dist \ | ||
./dist/voterwarehouse=/usr/bin/voterwarehouse \ | ||
./config.sample.yml=/etc/VoterWarehouse/config.yml | ||
echo "${{ secrets.JAMJON3_RPM_SIGN_GPG_KEY }}" | base64 -d > dist/key.gpg | ||
echo "${{ secrets.JAMJON3_RPM_SIGN_GPG_SECRET_KEY }}" | base64 -d > dist/private.gpg | ||
podman build --no-cache \ | ||
--build-arg PRIVATE_KEY_PASS=${{ secrets.JAMJON3_RPM_SIGN_PASSPHRASE }} \ | ||
-f Dockerfile.ubuntu \ | ||
-v "$(pwd)/dist:/dist:Z" . | ||
PACKAGE_FILE=$(find . -type f -name "voterwarehouse*.deb") | ||
apt_repos=( | ||
apt-focal-hosted | ||
) | ||
for repo in ${apt_repos[@]}; do | ||
DATA_BINARY='@' | ||
DATA_BINARY+="$PACKAGE_FILE" | ||
echo "$DATA_BINARY" | ||
echo "${NEXUS_APT_REPOSITORY_ROOT}${repo}/" | ||
curl -u "${APT_USER}:${APT_PASSWORD}" -H "Content-Type: multipart/form-data" --data-binary "${DATA_BINARY}" "${NEXUS_APT_REPOSITORY_ROOT}${repo}/" | ||
done | ||
# package_cloud push $PACKAGE_CLOUD_REPO $PACKAGE_FILE | ||
shell: bash | ||
env: | ||
PACKAGE_CLOUD_REPO: jamjon3/deb/any/any | ||
APT_USER: ${{ secrets.HOME_NEXUS_APT_USER }} | ||
APT_PASSWORD: ${{ secrets.HOME_NEXUS_APT_PASSWORD }} | ||
NEXUS_APT_REPOSITORY_ROOT: https://nexus.jamjon3.sytes.net/repository/ | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM docker.io/ubuntu:jammy AS jammy | ||
|
||
ARG PRIVATE_KEY_PASS | ||
|
||
ENV GPG_TTY /dev/console | ||
|
||
RUN apt-get update; apt-get install -y dpkg-sig gnupg | ||
|
||
WORKDIR /dist | ||
|
||
RUN gpg --import key.gpg \ | ||
&& echo '${PRIVATE_KEY_PASS}' | gpg --batch --import private.gpg \ | ||
&& PUBLIC_KEY_ID=$(gpg --list-keys | grep "^\s" | xargs) \ | ||
&& PACKAGE_FILE=$(find . -type f -name "voterwarehouse*.deb" | xargs basename) | ||
# && dpkg-sig -k $PUBLIC_KEY_ID --sign $PACKAGE_FILE | ||
# && dpkg-sig --verify $PACKAGE_FILE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Abstract class for handling Raw data import methods for State data | ||
|
||
from abc import ABC, abstractmethod | ||
|
||
|
||
class State(ABC): | ||
""" | ||
Import.Florida class provides methods to import voter and voter history from provided Zip files | ||
""" | ||
@property | ||
@abstractmethod | ||
def valid_import_types(self): | ||
pass | ||
|
||
@property | ||
@abstractmethod | ||
def history_keys(self): | ||
pass | ||
|
||
@property | ||
@abstractmethod | ||
def voter_keys(self): | ||
pass | ||
|
||
@property | ||
@abstractmethod | ||
def suppress_keys(self): | ||
pass | ||
|
||
def __init__(self, db): | ||
""" | ||
__init__ Sets the instance of Warehouse.Florida to a class variable named 'db'. | ||
:param db: An instance of Warehouse.Florida | ||
:return: None | ||
""" | ||
self.db = db | ||
|
||
def __enter__(self): | ||
""" | ||
__enter__ Returns itself. | ||
:return: Instance of Import.Florida | ||
""" | ||
return self | ||
|
||
def __exit__(self, exc_type, exc_val, exc_tb): | ||
""" | ||
__exit__ Sets Exits the class. | ||
:param exc_type: Execution Type | ||
:param exc_val: Execution Value | ||
:param exc_tb: Execution | ||
:return: self | ||
""" | ||
return self | ||
|
||
@abstractmethod | ||
def import_source(self, file, t) -> None: | ||
""" | ||
import_source Reads in a Voter or History File in Zip format and sends it to the datastore. | ||
:param t: String representing the type of zip file to import | ||
:param file: The full path to the Zip file | ||
:return: None | ||
""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.