Skip to content

Commit 3cbd896

Browse files
authored
Merge pull request #150 from topcoder-platform/develop
Merge for CI/CD test
2 parents f343de2 + 8e2e484 commit 3cbd896

File tree

21 files changed

+3409
-102
lines changed

21 files changed

+3409
-102
lines changed

.circleci/config.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
version: 2
2+
defaults: &defaults
3+
docker:
4+
- image: circleci/python:2.7-stretch-browsers
5+
install_dependency: &install_dependency
6+
name: Installation of build and deployment dependencies.
7+
command: |
8+
sudo apt install jq
9+
sudo pip install awscli --upgrade
10+
sudo pip install docker-compose
11+
install_deploysuite: &install_deploysuite
12+
name: Installation of install_deploysuite.
13+
command: |
14+
git clone --branch v1.4 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
15+
cp ./../buildscript/master_deploy.sh .
16+
cp ./../buildscript/buildenv.sh .
17+
cp ./../buildscript/awsconfiguration.sh .
18+
restore_cache_settings_for_build: &restore_cache_settings_for_build
19+
key: docker-node-modules-{{ checksum "package-lock.json" }}
20+
21+
save_cache_settings: &save_cache_settings
22+
key: docker-node-modules-{{ checksum "package-lock.json" }}
23+
paths:
24+
- node_modules
25+
26+
builddeploy_steps: &builddeploy_steps
27+
- checkout
28+
- setup_remote_docker
29+
- run: *install_dependency
30+
- run: *install_deploysuite
31+
#- restore_cache: *restore_cache_settings_for_build
32+
- run: ./build.sh ${APPNAME} ${CI_DEPLOY_TOKEN}
33+
#- save_cache: *save_cache_settings
34+
- deploy:
35+
name: Running MasterScript.
36+
command: |
37+
./awsconfiguration.sh $DEPLOY_ENV
38+
source awsenvconf
39+
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar
40+
source buildenvvar
41+
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME}
42+
43+
44+
jobs:
45+
# Build & Deploy against development backend
46+
"build-dev":
47+
<<: *defaults
48+
environment:
49+
DEPLOY_ENV: "DEV"
50+
LOGICAL_ENV: "dev"
51+
APPNAME: "vanilla-forums"
52+
CI_DEPLOY_TOKEN: $CI_DEPLOY_TOKEN
53+
steps: *builddeploy_steps
54+
55+
"build-prod":
56+
<<: *defaults
57+
environment:
58+
DEPLOY_ENV: "PROD"
59+
LOGICAL_ENV: "prod"
60+
APPNAME: "vanilla-forums"
61+
CI_DEPLOY_TOKEN: $CI_DEPLOY_TOKEN
62+
steps: *builddeploy_steps
63+
64+
workflows:
65+
version: 2
66+
build:
67+
jobs:
68+
# Development builds are executed on "develop" branch only.
69+
- "build-dev":
70+
context : org-global
71+
filters:
72+
branches:
73+
only:
74+
- develop
75+
76+
# Production builds are exectuted only on tagged commits to the
77+
# master branch.
78+
- "build-prod":
79+
context : org-global
80+
filters:
81+
branches:
82+
only: master

Dockerfile

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
FROM webdevops/php-apache
22

3+
ARG CI_DEPLOY_TOKEN
34
ARG VANILLA_VERSION=3.3
45
ENV WEB_DOCUMENT_ROOT /vanillapp
56

@@ -13,12 +14,35 @@ RUN chmod -R 777 /vanillapp
1314
RUN rm -R /vanillapp/plugins/stubcontent
1415
# Clone the forum-plugins repository
1516
RUN git clone https://github.com/topcoder-platform/forums-plugins.git /tmp/forums-plugins
17+
# Copy the Filestack plugin
18+
RUN git clone https://${CI_DEPLOY_TOKEN}@github.com/topcoder-platform/forums-filestack-plugin /tmp/forums-plugins/Filestack
19+
20+
#Copy the Groups plugin
21+
RUN git clone https://${CI_DEPLOY_TOKEN}@github.com/topcoder-platform/forums-groups-plugin /tmp/forums-plugins/Groups
22+
23+
#Copy the SumoLogic plugin
24+
RUN git clone https://${CI_DEPLOY_TOKEN}@github.com/topcoder-platform/forums-sumologic-plugin /tmp/forums-plugins/Sumologic
25+
1626
# Copy all plugins to the Vanilla plugins folder
1727
RUN cp -r /tmp/forums-plugins/. /vanillapp/plugins
28+
29+
#Get the debug bar plugin
30+
RUN wget https://us.v-cdn.net/5018160/uploads/addons/KSBIPJYMC0F2.zip
31+
RUN unzip KSBIPJYMC0F2.zip
32+
RUN cp -r debugbar /vanillapp/plugins
33+
34+
# Install Topcoder dependencies
35+
RUN composer install --working-dir /vanillapp/plugins/Topcoder
36+
# Install Filestack dependencies
37+
RUN composer install --working-dir /vanillapp/plugins/Filestack
38+
# Install Groups dependencies
39+
RUN composer install --working-dir /vanillapp/plugins/Groups
1840
# Copy Vanilla configuration files
1941
COPY ./config/vanilla/. /vanillapp/conf/.
2042
# Copy Topcoder Vanilla files
2143
COPY ./vanilla/. /vanillapp/.
22-
44+
# Set permissions on config file
45+
RUN chown application:application /vanillapp/conf/config.php
46+
RUN chmod ug=rwx,o=rx /vanillapp/conf/config.php
2347
# Clone the forum-theme repository
24-
RUN git clone 'https://github.com/topcoder-platform/forums-theme.git' /vanillapp/themes/topcoder-theme
48+
RUN git clone 'https://github.com/topcoder-platform/forums-theme.git' /vanillapp/themes/topcoder-theme

build.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
APP_NAME=$1
4+
CI_DEPLOY_TOKEN=$2
5+
UPDATE_CACHE=""
6+
echo "" > vanilla.env
7+
CI_DEPLOY_TOKEN=$CI_DEPLOY_TOKEN docker-compose -f docker-compose.yml build $APP_NAME
8+
#docker create --name app $APP_NAME:latest

config/vanilla/bootstrap.before.php

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
<?php if (!defined('APPLICATION')) exit();
1+
<?php
2+
3+
use Vanilla\Formatting\DateTimeFormatter;
4+
5+
if (!defined('APPLICATION')) exit();
26

37
if (!function_exists('formatString')) {
48
/**
@@ -257,9 +261,12 @@ function _formatStringCallback($match, $setArgs = false) {
257261
// Store this name separately because of special 'You' case.
258262
$name = formatUsername($user, $format, $contextUserID);
259263
// Manually build instead of using userAnchor() because of special 'You' case.
260-
if(function_exists('topcoderRatingCssClass')) {
264+
if(function_exists('topcoderRatingCssClass') &&
265+
function_exists('topcoderRoleCssStyles')) {
261266
$ratingCssClass = topcoderRatingCssClass($user->Name);
262-
$result = anchor(htmlspecialchars($name), userUrl($user), $ratingCssClass);
267+
$roleCssClass = topcoderRoleCssStyles($user->Name);
268+
$topcoderStyles =$ratingCssClass.' '.$roleCssClass;
269+
$result = anchor(htmlspecialchars($name), userUrl($user), $topcoderStyles);
263270
} else {
264271
$result = anchor(htmlspecialchars($name), userUrl($user));
265272
}
@@ -276,6 +283,41 @@ function _formatStringCallback($match, $setArgs = false) {
276283
break;
277284
}
278285
}
286+
return $result;
287+
}
288+
}
289+
290+
if (!function_exists('dateUpdated')) {
291+
/**
292+
*
293+
* Fixed issues with date format:
294+
* package/library/core/functions.render.php
295+
*
296+
* @param $row
297+
* @param null $wrap
298+
* @return string
299+
*/
300+
function dateUpdated($row, $wrap = null) {
301+
$result = '';
302+
$dateUpdated = val('DateUpdated', $row);
303+
$updateUserID = val('UpdateUserID', $row);
304+
305+
if ($dateUpdated) {
306+
$updateUser = Gdn::userModel()->getID($updateUserID);
307+
$dateUpdatedFormatted = Gdn::getContainer()->get(DateTimeFormatter::class)->formatDate($dateUpdated, false, DateTimeFormatter::FORCE_FULL_FORMAT);
308+
if ($updateUser) {
309+
$title = sprintf(t('Edited %s by %s.'), $dateUpdatedFormatted, val('Name', $updateUser));
310+
} else {
311+
$title = sprintf(t('Edited %s.'), $dateUpdatedFormatted);
312+
}
313+
314+
$result = ' <span title="'.htmlspecialchars($title).'" class="DateUpdated">'.
315+
sprintf(t('edited %s'), $dateUpdatedFormatted).'</span> ';
316+
if ($wrap) {
317+
$result = $wrap[0].$result.$wrap[1];
318+
}
319+
}
320+
279321
return $result;
280322
}
281323
}

0 commit comments

Comments
 (0)