forked from LINCnil/pia
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Replace PATCH by POST in order to fix issue with PHP PUT/PATCH management * comment date creation (server responsibility) * add api services and models * Update UI * Add current user to app header * Existing components and services refactoring * Add logout and update app logo * Lint * Fix import example feature * Fix api deletion * Prevent session loss * Move API settings to environment file * Fix token expiry check * Add token expiry date format to env settings * Fix evaluation status label * Fix http query params format * [CI] Add some Basic LiCi tools (#3) (#4) * limit unnecessary requests and fix issues in entry-content/* * fix summary component * Remove unused component * Add role based authorization * reduce the number of request during evaluation and validation * Fix attachment download * fix Pia import and date manipulation * add Pia progress computation in CardsComponent::refreshContent() * call sortPia after import * fix issue when evaluation* is undefiend in action-plan.service * [CI] Add env management with etcd and confd * [CI] Add explicit version of etcd api * [CI] Add some ci-script to automate various process * Fix summary component
- Loading branch information
1 parent
42b89d5
commit c15f8c0
Showing
130 changed files
with
5,162 additions
and
3,265 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
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,14 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
if [ -f ${NVM_DIR}/nvm.sh ] | ||
then | ||
. ${NVM_DIR}/nvm.sh | ||
else | ||
echo "NVM_DIR have to be set" | ||
exit 42 | ||
fi | ||
|
||
# todo : add build option env variable | ||
ng build | ||
|
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,29 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
Name=Pialab-front | ||
|
||
if [ -z ${Branch} ] | ||
then | ||
Branch=$(git name-rev --name-only $(git rev-parse HEAD) | sed -e s/\\^.*//g | awk -F'/' '{print $(NF)}') | ||
fi | ||
|
||
# Clean current git dir | ||
git clean -df | ||
git checkout -- . | ||
|
||
Filename=${Name}_${Branch}.tar.gz | ||
|
||
rm -f ${Filename} | ||
|
||
rm -rf \ | ||
*.log \ | ||
*.nbr \ | ||
*.dist | ||
|
||
tar --exclude-vcs \ | ||
--exclude=build \ | ||
--exclude=bin/git-scripts \ | ||
-czhf ${Filename} ./* | ||
|
||
sha256sum ${Filename} > ${Filename}.sha256.txt |
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,13 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
if [ -f ${NVM_DIR}/nvm.sh ] | ||
then | ||
. ${NVM_DIR}/nvm.sh | ||
else | ||
echo "NVM_DIR have to be set" | ||
exit 42 | ||
fi | ||
|
||
|
||
npm install --no-interaction |
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,6 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
|
||
echo "waiting for test creation" | ||
|
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,56 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
export ETCDCTL_API=3 | ||
|
||
# rand number to avoid build colision (same db used by two build) | ||
if [ ! -f shuf.nbr ] | ||
then | ||
shuf -i 200-600 -n 1 > shuf.nbr | ||
fi | ||
|
||
if [ -z "$Suffix" ] | ||
then | ||
#RND may contain branch with '-' or upper case char which may not work as database name for postgre | ||
Suffix=$(echo $RND|sed -e s/-/_/g|tr '[:upper:]' '[:lower:]')$(echo -n $(cat shuf.nbr )) | ||
fi | ||
|
||
if [ -z "$Prefix" ] | ||
then | ||
Prefix="/pialab/build/$Suffix" | ||
fi | ||
|
||
if [ -z "$ETCDHOST" ] | ||
then | ||
ETCDHOST="etcd.host" | ||
fi | ||
ETCDENDPOINT="--endpoints=http://${ETCDHOST}:2379" | ||
|
||
if [ -z "$ETCDCTLCMD" ] | ||
then | ||
ETCDCTLCMD="etcdctl" | ||
fi | ||
|
||
if [ -z "${APICLIENTID}" ] | ||
then | ||
APICLIENTID=1234 | ||
fi | ||
|
||
if [ -z "${APICLIENTSECRET}" ] | ||
then | ||
APICLIENTSECRET=4321 | ||
fi | ||
|
||
if [ -z "${BACKURL}" ] | ||
then | ||
BACKURL='http://localhost:8000' | ||
fi | ||
|
||
# todo add env management (prod and dev) | ||
|
||
$ETCDCTLCMD put $Prefix/api/client/id ${APICLIENTID} $ETCDENDPOINT | ||
$ETCDCTLCMD put $Prefix/api/client/secret ${APICLIENTSECRET} $ETCDENDPOINT | ||
$ETCDCTLCMD put $Prefix/api/host/url ${BACKURL} $ETCDENDPOINT | ||
|
||
confd -onetime -backend etcdv3 -node http://${ETCDHOST}:2379 -confdir ./etc/confd -log-level debug -prefix $Prefix | ||
cat src/environments/environment.ts |
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,8 @@ | ||
[template] | ||
src = "environment.ts.tmpl" | ||
dest = "src/environments/environment.ts" | ||
keys = [ | ||
"/api/client/id", | ||
"/api/client/secret", | ||
"/api/host/url", | ||
] |
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,14 @@ | ||
|
||
export const environment = { | ||
name: 'development', | ||
production: false, | ||
version: 'DEV', | ||
rollbar_key: '', | ||
date_format: 'DD MM YY HH:mm:ss', | ||
api: { | ||
client_id: '{{getv "/api/client/id"}}', | ||
client_secret: '{{getv "/api/client/secret"}}', | ||
host: '{{getv "/api/host/url"}}', | ||
token_path: '/oauth/v2/token' | ||
}, | ||
}; |
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,42 @@ | ||
FROM debian:stable | ||
|
||
RUN apt-get update && apt-get install --no-install-recommends -y apt-transport-https lsb-release ca-certificates net-tools lsof postgresql-client wget \ | ||
&& apt-get install --no-install-recommends -y git curl build-essential unzip python-pip python-setuptools \ | ||
&& apt-get install --no-install-recommends -y dnsutils vim-nox\ | ||
&& apt-get autoremove -y && apt-get clean | ||
|
||
ENV HOME=/home/jenkins | ||
ENV USER=jenkins | ||
ENV GROUP=users | ||
|
||
ARG UID | ||
ARG GID | ||
RUN useradd -d $HOME -g ${GID} -u ${UID} -m $USER -s /bin/bash \ | ||
&& mkdir -p $HOME/bin \ | ||
&& chown -R $USER:$GROUP $HOME | ||
|
||
ARG ETCDVER=3.3.1 | ||
RUN wget -q https://github.com/coreos/etcd/releases/download/v${ETCDVER}/etcd-v${ETCDVER}-linux-amd64.tar.gz -O /tmp/etcd.tar.gz \ | ||
&& tar -xzf /tmp/etcd.tar.gz -C /tmp \ | ||
&& mv /tmp/etcd-v${ETCDVER}-linux-amd64/etcd* /usr/local/bin/ \ | ||
&& chmod 755 /usr/local/bin/etcd* \ | ||
&& rm -rf /tmp/etcd* | ||
|
||
ARG CONFDVER=0.15.0 | ||
RUN wget -q https://github.com/kelseyhightower/confd/releases/download/v${CONFDVER}/confd-${CONFDVER}-linux-amd64 -O /usr/local/bin/confd \ | ||
&& chmod 755 /usr/local/bin/confd \ | ||
&& mkdir -p /etc/confd/conf.d \ | ||
&& mkdir -p /etc/confd/templates | ||
|
||
USER $USER:$GROUP | ||
WORKDIR $HOME | ||
|
||
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin/:$HOME/bin:$HOME/.local/bin/ | ||
|
||
ENV NVM_DIR="$HOME/.nvm" | ||
RUN curl -so- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash \ | ||
&& [ -s "$NVM_DIR/nvm.sh" ] \ | ||
&& . "$NVM_DIR/nvm.sh" \ | ||
&& nvm install 8.11.1 \ | ||
&& npm install -g @angular/cli | ||
|
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,71 @@ | ||
pipeline { | ||
agent { | ||
dockerfile { | ||
filename "etc/dockerfile.jenkins" | ||
additionalBuildArgs '--build-arg UID=$(id -u) --build-arg GID=$(id -g)' | ||
args '--network=ci.network' | ||
} | ||
} | ||
|
||
environment { | ||
NVM_DIR="/home/jenkins/.nvm" | ||
ETCDHOST="etcd.host" | ||
/* warnings, can't use "$HOME/.nvm" as it is not the same in docker and host ... */ | ||
} | ||
|
||
options { | ||
timeout(time: 1, unit: 'HOURS') | ||
timestamps() | ||
disableConcurrentBuilds() | ||
ansiColor('xterm') | ||
} | ||
|
||
stages { | ||
stage ('Where Am I') { | ||
steps { | ||
sh "uname -a" | ||
sh ". ${env.NVM_DIR}/nvm.sh && npm -v" | ||
sh ". ${env.NVM_DIR}/nvm.sh && node -v" | ||
} | ||
} | ||
|
||
stage ('Set Env') { | ||
steps { | ||
sh "./bin/ci-scripts/set_env_with_etcd.sh" | ||
} | ||
} | ||
|
||
stage ('Composer Install') { | ||
steps { | ||
sh "./bin/ci-scripts/install.sh" | ||
} | ||
} | ||
|
||
stage ('Build Project') { | ||
steps { | ||
sh "./bin/ci-scripts/build.sh" | ||
} | ||
} | ||
|
||
stage ('Run Test') { | ||
steps { | ||
sh "./bin/ci-scripts/run_test.sh" | ||
} | ||
} | ||
|
||
stage ('Create Archive') { | ||
steps { | ||
sh 'Branch=${BRANCH_NAME} ./bin/ci-scripts/gen_archive.sh' | ||
archiveArtifacts artifacts: "*.tar.gz*", fingerprint: true | ||
build job: 'Copy Artifact', parameters: [string(name: 'Job', value: "${JOB_NAME}"), string(name: 'Project', value: "Pialab"), string(name: 'Branch', value: "${BRANCH_NAME}"), string(name: 'DoDeploy', value: "false")], wait: false | ||
} | ||
} | ||
|
||
} | ||
|
||
post { | ||
always { | ||
cleanWs() | ||
} | ||
} | ||
} |
Oops, something went wrong.