Commit 28c71d3c authored by Hamaker, Alec's avatar Hamaker, Alec
Browse files

Merge branch 'feature/fix-versions' into 'develop'

Feature/fix versions

See merge request nset-utilities/common-package!15
parents 4ae9a9d4 fd9d68d5
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -7,3 +7,5 @@ __pycache__/

.DS_Store
src/.DS_Store
# ignore backup files
*.bak

COMMON_VERSION

0 → 100644
+1 −0
Original line number Diff line number Diff line
0.1.14
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
FROM python:3.9-slim
FROM --platform=linux/amd64 python:3.9-slim

RUN apt-get -yqq update && apt-get -yqq upgrade && \
      apt-get -yqq install vim && apt-get -yqq install postgresql-client
+5 −2
Original line number Diff line number Diff line
@@ -7,9 +7,9 @@ Everything is configurable with environmental variables.

### Installation via pip

Run this command to install version 0.1.3 (latest) via pip:
Run this command to install version 0.1.14 (latest) via pip:

`python3 -m pip --no-cache-dir install common==0.1.3 --index-url https://code.ornl.gov/api/v4/projects/10568/packages/pypi/simple  --trusted-host code.ornl.gov`
`python3 -m pip --no-cache-dir install common==0.1.14 --index-url https://code.ornl.gov/api/v4/projects/10568/packages/pypi/simple  --trusted-host code.ornl.gov`
This will install latest (not recommended):

`python3 -m pip --no-cache-dir install common --index-url https://code.ornl.gov/api/v4/projects/10568/packages/pypi/simple  --trusted-host code.ornl.gov`
@@ -20,6 +20,9 @@ A docker image and python package are provided for use as a base image in `docke

`common_package/sql/` contains the .sql files `create_tables.sql` and `fill_tables.sql` which serve as examples for how to initialize a postgres Database in your project (See below in the Creating an extensible Database Python Class section for details in how to create the Python Class.) The `volumes` statement in the docker-compose files runs these sql files once the container is created.

## Releases

To initiate a release, increment the value in `COMMON_VERSION` run `./release.sh release`. This will force checkout develop and run the release process to push to the package registry and container registry.

### Configuration via Environment Variables
Below is a list of environmental variables and what they do:

release.sh

0 → 100755
+80 −0
Original line number Diff line number Diff line
#!/bin/bash
set -eux
# -*- coding: utf-8 -*-
#/ Perform releases of the common package. Make sure to increment COMMON_VERSION.
#/ Usage:
#/   ./release.sh
#/
#/   release)
#/      release the ei package version based on values in COMMON_VERSION and
#/      update the docker container/image
#/   -h|-?|--help)
#/      show this help and exit


banner() {
BANNER=""                                           
BANNER="$BANNER\n  ___ ___  _ __ ___  _ __ ___   ___  _ __  "
BANNER="$BANNER\n / __/ _ \\| '_ \` _ \\| '_ \` _ \\ / _ \\| '_ \\ "
BANNER="$BANNER\n| (_| (_) | | | | | | | | | | | (_) | | | |"
BANNER="$BANNER\n \\___\\___/|_| |_| |_|_| |_| |_|\\___/|_| |_|"
BANNER="$BANNER\n               package helpers"
echo -e "$BANNER\n\n"
}

die() { 
  echo -e "\033[31mFAILURE:\033[39m $1"
  exit 1
} 
warn() { 
  echo -e "\033[33mWARNING:\033[39m $1"
} 
info() {
  echo -e "\033[32mINFO:\033[39m $1"
}
show_help() { 
  grep '^#/' "${BASH_SOURCE[0]}" | cut -c4- || \
    die "Failed to display usage information"
}
banner
while :; do
  case $1 in 
    release)
      info "Checking out develop branch."
      git checkout develop && git pull
      COMMON_VERSION=$(cat COMMON_VERSION)
      COMMON_SETUP_REGEX="s/(?<=version \= ')\d+\.\d+\.\d+/$COMMON_VERSION/g"
      COMMON_README_REGEX="s/(?<=common\=\=)\d+\.\d+\.\d+/$COMMON_VERSION/g"
      COMMON_README_ADDTL_REGEX="s/(?<=version )\d+\.\d+\.\d+/$COMMON_VERSION/g"
      COMMON_README_FILE="./README.md"
      COMMON_SETUP_FILE="src/setup.py"
      echo $COMMON_VERSION
      perl -pi.bak -e "$COMMON_SETUP_REGEX" "$COMMON_SETUP_FILE"
      perl -pi.bak -e "$COMMON_README_REGEX" "$COMMON_README_FILE"
      perl -pi.bak -e "$COMMON_README_ADDTL_REGEX" "$COMMON_README_FILE"
      cd ./src && ./upload.sh
      cd ..
      ./build.sh --tag "$COMMON_VERSION"
      git add src/setup.py README.md && \
      git commit -m 'bump common version' && \
      git push
      exit
      ;;
    -h|-\?|--help) 
      show_help
      exit
      ;;
  esac
done
    










Loading