Merge pull request #39 from yardstick/feature/QUANT-3102

QUANT-3102: use Nexus to do builds
This commit is contained in:
brmnjsh 2023-12-05 11:00:47 -05:00 committed by GitHub
commit 4fe8308e94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 100 deletions

View File

@ -1,25 +0,0 @@
FROM python:3.9.6
RUN apt-get update
RUN apt-get -y install coinor-cbc
RUN python -m pip install pulp
RUN python -m pip install pydantic
RUN python -m pip install daemonize
RUN python -m pip install sqspy
RUN python -m pip install -U pytest
RUN python -m pip install pytest-cov
RUN python -m pip install pytest-stub
RUN python -m pip install pytest-mock
RUN python -m pip install girth --upgrade
RUN mkdir /app
WORKDIR /app
ENV LOCAL_DEV True
# Bundle app source
COPY . /app
WORKDIR /app/app
CMD [ "python", "main.py" ]

View File

@ -1,48 +0,0 @@
#!/usr/bin/env bash
. $MEASURE_SRC_PATH/.vagrantrc
[ ! -f docker-compose.override.yml ] && cat <<YAML > docker-compose.override.yml
override_file_placeholder:
image: busybox
YAML
measure-vagrant-id() {
vagrant global-status | grep 'yardstick\s*$' | awk '{ print $1 }'
}
vagrant-shell() {
vagrant ssh `measure-vagrant-id`
}
vagrant-ssh() {
vagrant ssh `measure-vagrant-id` -c "$*"
}
compose() {
vagrant-ssh "cd /apps/measure-solver && \\
docker-compose -f '/app/docker-compose.yml' \\
-f '/apps/measure-solver/docker-compose.yml' \\
-f '/apps/measure-solver/docker-compose.override.yml' \\
$*"
}
run() {
compose "run --rm measure-solver $*"
}
run-script() {
run "rails $*"
}
measure-solver-logs() {
compose "logs measure-solver"
}
restart-measure-solver() {
compose "restart measure-solver"
}
rails() {
run-script "$*"
}

View File

@ -1,23 +1,26 @@
FROM python:3.9.6
FROM python:3.9.6 AS base
LABEL maintainer='Meazure Developers <devs@getyardstick.com>'
RUN apt-get update
RUN apt-get -y install coinor-cbc
RUN python -m pip install pulp
RUN python -m pip install pydantic
RUN python -m pip install daemonize
RUN python -m pip install sqspy
RUN python -m pip install -U pytest
RUN python -m pip install pytest-cov
RUN python -m pip install pytest-stub
RUN python -m pip install pytest-mock
RUN python -m pip install girth --upgrade
ARG PIP_INDEX_URL
ARG PIP_INDEX
ENV PIP_INDEX_URL $PIP_INDEX_URL
ENV PIP_INDEX $PIP_INDEX
ENV PIP_TARGET /pip
ENV PYTHONPATH /pip
RUN mkdir /app
WORKDIR /app
# Bundle app source
CMD [ "python", "app/main.py" ]
FROM base AS development
FROM base
COPY . /app
WORKDIR /app/app
CMD [ "python", "main.py" ]
RUN python -m pip install -r requirements.txt

19
Jenkinsfile vendored
View File

@ -11,8 +11,18 @@ pipeline {
stages {
stage('Build Kaniko image') {
steps {
withCredentials([usernamePassword(credentialsId: 'DockerHubAccessYardstick', usernameVariable: 'USER', passwordVariable: 'PASS')]) {
container('kaniko') {
withVault([ vaultSecrets: [
[
path: "ci/general",
engineVersion: 1,
secretValues: [
[envVar: 'PIP_USER', vaultKey: 'SONATYPE_READONLY_USER'],
[envVar: 'PIP_PASSWORD', vaultKey: 'SONATYPE_READONLY_USER_PASSCODE']
]
]
]]) {
withCredentials([usernamePassword(credentialsId: 'DockerHubAccessYardstick', usernameVariable: 'USER', passwordVariable: 'PASS')]) {
container('kaniko') {
checkout scm
// Setup docker credentials
sh 'echo "{\\"auths\\":{\\"https://index.docker.io/v1/\\":{\\"auth\\":\\"$(printf "%s:%s" "$USER" "$PASS" | base64 | tr -d \'\n\')\\"}}}" > /kaniko/.docker/config.json'
@ -23,13 +33,16 @@ pipeline {
--insecure=true \
--insecure-registry=docker-registry.default:5000 \
--cache=true \
--build-arg PIP_INDEX_URL=https://${PIP_USER}:${PIP_PASSWORD}@artifact.it.getyardstick.com/repository/meazurelearning-pypi/simple \
--build-arg PIP_INDEX=https://${PIP_USER}:${PIP_PASSWORD}@artifact.it.getyardstick.com/repository/meazurelearning-pypi/pypi \
--cache-repo=docker-registry.default:5000/${REPOSITORY} \
--destination ${env.REPOSITORY}:\$(echo ${BRANCH_NAME} | grep -Eo 'feature/([A-Za-z]+-[0-9]*)' | grep -Eo '[A-Za-z]+-[0-9]*' || \
echo ${BRANCH_NAME} | grep -Eo '(release|hotfix)/[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+' | grep -Eo '[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+' || \
echo ${BRANCH_NAME} | grep -Eo 'YASDEV-([[:digit:]]*)')
"""
}
}
}
}
}
}
}

View File

@ -1,4 +1,4 @@
from girth import ability_mle
from mirth import ability_mle
from lib.irt.models.base import *

9
rc
View File

@ -1,9 +0,0 @@
#!/usr/bin/env bash
export MEASURE_SRC_PATH=../yardstick
if [ -f .user_rc ]; then
. .user_rc
fi
source .vagrantrc

9
requirements.txt Normal file
View File

@ -0,0 +1,9 @@
daemonize==2.5.0
mirth==0.10.3
PuLP==2.7.0
pydantic==2.4.2
pytest==7.4.2
pytest-cov==4.1.0
pytest-mock==3.11.1
pytest-stub==1.1.0
sqspy==1.0.0