Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 5b1be56

Browse files
authored
Merge pull request #465 from appirio-tech/dev
Fixed download URL challenge, label updates, challenge type cleanup.
2 parents 15ce1d1 + 1b956a5 commit 5b1be56

File tree

27 files changed

+511
-116
lines changed

27 files changed

+511
-116
lines changed

.circleci/config.yml

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,14 @@ jobs:
2424
wget http://downloads.sourceforge.net/project/jboss/JBoss/JBoss-4.2.3.GA/jboss-4.2.3.GA-jdk6.zip
2525
unzip jboss-4.2.3.GA-jdk6.zip
2626
cd project
27-
- run:
28-
name: checking out build repo
29-
command: |
30-
git clone --branch master https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
31-
#git clone --branch master git@github.com:appirio-tech/ops.git ../direct-config-update
32-
#git clone --branch master https://$GITUSER:$GITPASSWD@github.com/appirio-tech/ops ../direct-config-update
3327
- checkout
34-
- run:
35-
name: copying configuration file
36-
command: |
37-
cp ./../buildscript/direct/conf/dev/token.properties.enc .
38-
openssl enc -aes-256-cbc -d -in token.properties.enc -out token.properties -k $SECPASSWD
3928
- run:
4029
name: Installation of build dependencies.
4130
command: |
4231
javac -version
4332
ant -version
4433
aws --version
34+
./buildproperties.sh -e DEV -k directapp
4535
ant package-direct package-static-direct
4636
- store_artifacts:
4737
path: ./direct.jar
@@ -148,24 +138,14 @@ jobs:
148138
wget http://downloads.sourceforge.net/project/jboss/JBoss/JBoss-4.2.3.GA/jboss-4.2.3.GA-jdk6.zip
149139
unzip jboss-4.2.3.GA-jdk6.zip
150140
cd project
151-
- run:
152-
name: checking out build repo
153-
command: |
154-
git clone --branch master https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
155-
#git clone --branch master git@github.com:appirio-tech/ops.git ../direct-config-update
156-
#git clone --branch master https://$GITUSER:$GITPASSWD@github.com/appirio-tech/ops ../direct-config-update
157141
- checkout
158-
- run:
159-
name: copying configuration file
160-
command: |
161-
cp ./../buildscript/direct/conf/prod/token.properties.enc .
162-
openssl enc -aes-256-cbc -d -in token.properties.enc -out token.properties -k $SECPASSWD
163142
- run:
164143
name: Installation of build dependencies.
165144
command: |
166145
javac -version
167146
ant -version
168147
aws --version
148+
./buildproperties.sh -e PROD -k directapp
169149
ant package-direct package-static-direct
170150
- store_artifacts:
171151
path: ./direct.jar

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ direct-app
22
==========
33

44
## building
5-
To build, download the docker build container that has all of the build dependencies. You can then run the container to build your local source code.
5+
To build, download the docker build container that has all of the build dependencies. You can then run the container to build your local source code.
66

77
1. Clone the github source directory
88
2. Rename `token.properties.docker` to `token.properties` in the source directory

build-package.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ then
88
fi
99

1010
VER=`date "+%Y%m%d%H%M"`
11+
SCRIPTDIR="./scripts"
1112

1213
directapp_cdpacakge()
1314
{
@@ -16,7 +17,7 @@ directapp_cdpacakge()
1617
source $BUILD_VARIABLE_FILE_NAME
1718
AWS_CD_PACKAGE_NAME="${APPNAME}-${PACKAGETYPE}-${VER}.zip"
1819
PACAKAGE_LOCATION="dist-${PACKAGETYPE}"
19-
SCRIPTDIR="./../buildscript/direct/scripts"
20+
# SCRIPTDIR="./../buildscript/direct/scripts"
2021
rm -rf $PACAKAGE_LOCATION
2122
mkdir $PACAKAGE_LOCATION
2223
#cd $PACAKAGE_LOCATION

build.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@
359359
<include name="phase_templates/**/*.xml" />
360360
<include name="xml_phase_template.xsd" />
361361
<include name="AwsCredentials.properties" />
362+
<include name="AwsS3Credentials.properties" />
362363
<include name="contest_creation_sns_message.txt" />
363364
<include name="contest_update_sns_message.txt" />
364365
</fileset>
@@ -526,7 +527,8 @@
526527
<copy file="${tokenized_conf}/direct-ds.xml" todir="${jboss.home}/server/${server.name}/deploy" overwrite="true"/>
527528
<copy todir="${jboss.home}/server/${server.name}/conf" overwrite="true">
528529
<fileset dir="${tokenized_conf}">
529-
<include name="ApplicationServer.properties" />
530+
<include name="AwsS3Credentials.properties" />
531+
<include name="ApplicationServer.properties" />
530532
<include name="DBMS.properties" />
531533
<include name="DataAccess.properties" />
532534
<include name="cache.properties" />

buildproperties.sh

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#!/bin/bash
2+
KEY_LOCATION=""
3+
BUILDENV_LIST=""
4+
usage()
5+
{
6+
cat << EOF
7+
usage: $0 options
8+
This script need to be executed with below option.
9+
OPTIONS:
10+
-e environment
11+
-b Security file location GIT|AWS
12+
-k key location
13+
EOF
14+
}
15+
#log Function - Used to provide information of execution information with date and time
16+
log()
17+
{
18+
echo "`date +'%D %T'` : $1"
19+
}
20+
track_error()
21+
{
22+
if [ $1 != "0" ]; then
23+
log "$2 exited with error code $1"
24+
log "completed execution IN ERROR at `date`"
25+
exit $1
26+
fi
27+
28+
}
29+
download_buildenvfile()
30+
{
31+
if [ -z "$BUILDENV_LIST" ];
32+
then
33+
if [ -z "$KEY_LOCATION" ];
34+
then
35+
track_error $? "Please provide the file list using -b or file location -k or both -b and -k "
36+
else
37+
aws s3 sync s3://tc-buildproperties-${ENV_CONFIG}/$KEY_LOCATION .
38+
track_error $? "Environment setting"
39+
fi
40+
41+
else
42+
Buffer_seclist=$(echo $BUILDENV_LIST | sed 's/,/ /g' )
43+
for listname in $Buffer_seclist;
44+
do
45+
if [ -z "$KEY_LOCATION" ];
46+
then
47+
aws s3 cp s3://tc-buildproperties-${ENV_CONFIG}/$listname .
48+
track_error $? "Environment setting"
49+
else
50+
aws s3 cp s3://tc-buildproperties-${ENV_CONFIG}/$KEY_LOCATION/$listname .
51+
track_error $? "Environment setting"
52+
fi
53+
done
54+
fi
55+
56+
}
57+
58+
configure_aws_cli() {
59+
aws --version
60+
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
61+
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
62+
aws configure set default.region $AWS_REGION
63+
aws configure set default.output json
64+
log "Configured AWS CLI."
65+
}
66+
67+
while getopts .b:e:k:. OPTION
68+
do
69+
case $OPTION in
70+
e)
71+
ENV=$OPTARG
72+
;;
73+
b)
74+
BUILDENV_LIST=$OPTARG
75+
;;
76+
k)
77+
KEY_LOCATION=$OPTARG
78+
;;
79+
?)
80+
log "additional param required"
81+
usage
82+
exit
83+
;;
84+
esac
85+
done
86+
87+
AWS_ACCESS_KEY_ID=$(eval "echo \$${ENV}_AWS_ACCESS_KEY_ID")
88+
AWS_SECRET_ACCESS_KEY=$(eval "echo \$${ENV}_AWS_SECRET_ACCESS_KEY")
89+
AWS_REGION=$(eval "echo \$${ENV}_AWS_REGION")
90+
if [ -z $AWS_REGION ];
91+
then
92+
AWS_REGION="us-east-1"
93+
fi
94+
if [ -z $AWS_ACCESS_KEY_ID ] || [ -z $AWS_SECRET_ACCESS_KEY ] ;
95+
then
96+
log "AWS Secret Parameters are not configured in circleci/environment"
97+
usage
98+
exit 1
99+
else
100+
configure_aws_cli
101+
fi
102+
ENV_CONFIG=`echo "$ENV" | tr '[:upper:]' '[:lower:]'`
103+
download_buildenvfile

components/deliverable_management/src/java/main/com/topcoder/management/deliverable/Upload.java

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2006,2010 TopCoder Inc., All Rights Reserved.
2+
* Copyright (C) 2006 - 2018 TopCoder Inc., All Rights Reserved.
33
*/
44
package com.topcoder.management.deliverable;
55

@@ -19,9 +19,13 @@
1919
* This class is highly mutable. All fields can be changed.
2020
* </p>
2121
*
22+
* <p>
23+
* Version 1.3 - Topcoder - Change Download URL in Direct Application
24+
* - Add url property
25+
* </p>
2226
* @author aubergineanode, singlewood
2327
* @author TCSDESIGNER, TCSDEVELOPER
24-
* @version 1.2
28+
* @version 1.3
2529
*/
2630
public class Upload extends AuditedDeliverableStructure {
2731
/**
@@ -93,6 +97,12 @@ public class Upload extends AuditedDeliverableStructure {
9397
*/
9498
private String description;
9599

100+
/**
101+
* Represent the s3 url
102+
*
103+
*/
104+
private String url;
105+
96106
/**
97107
* Creates a new Upload.
98108
*/
@@ -267,4 +277,22 @@ public boolean isValidToPersist() {
267277
&& (parameter != null)
268278
&& (super.isValidToPersist()));
269279
}
280+
281+
/**
282+
* Get url
283+
*
284+
* @return url
285+
*/
286+
public String getUrl() {
287+
return url;
288+
}
289+
290+
/**
291+
* Set url
292+
*
293+
* @param url url
294+
*/
295+
public void setUrl(String url) {
296+
this.url = url;
297+
}
270298
}

components/deliverable_management/src/java/main/com/topcoder/management/deliverable/persistence/sql/SqlUploadPersistence.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2006-2012 TopCoder Inc., All Rights Reserved.
2+
* Copyright (C) 2006-2018 TopCoder Inc., All Rights Reserved.
33
*/
44
package com.topcoder.management.deliverable.persistence.sql;
55

@@ -193,7 +193,14 @@
193193
* <li>Update {@link #loadUpload(CustomResultSet)} to load the project phase id.</li>
194194
* </ol>
195195
* </p>
196-
*
196+
*
197+
* <p>
198+
* Version 1.6 - Topcoder - Change Download URL in Direct Application
199+
* <ol>
200+
* <li>Update {@link #loadUpload(CustomResultSet)} to load url.</li>
201+
* </ol>
202+
* </p>
203+
*
197204
* <strong>Thread Safety:</strong> This class is immutable and thread-safe in the sense that multiple threads can not
198205
* corrupt its internal data structures. However, the results if used from multiple threads can be unpredictable as the
199206
* database is changed from different threads. This can equally well occur when the component is used on multiple
@@ -202,7 +209,7 @@
202209
*
203210
* @author aubergineanode, saarixx, urtks, George1
204211
* @author TCSDESIGNER, TCSDEVELOPER
205-
* @version 1.5
212+
* @version 1.6
206213
*/
207214
public class SqlUploadPersistence implements UploadPersistence {
208215

@@ -2525,6 +2532,7 @@ private Upload loadUpload(CustomResultSet resultSet) throws UploadPersistenceExc
25252532
upload.setCreationTimestamp(resultSet.getDate("upload_create_date"));
25262533
upload.setModificationUser(resultSet.getString("upload_modify_user"));
25272534
upload.setModificationTimestamp(resultSet.getDate("upload_modify_date"));
2535+
upload.setUrl(resultSet.getString("upload_url"));
25282536

25292537
upload.setProject(resultSet.getLong("project_id"));
25302538
if (resultSet.getObject("project_phase_id") != null) {

conf/AwsS3Credentials.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
accessKey = @aws_s3_access_key@
2+
secretKey = @aws_s3_secret_key@

conf/components/com/topcoder/util/config/ConfigManager.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ com.cronos.onlinereview.services.uploads.impl.DefaultManagersProvider = onlineRe
1010
com.cronos.onlinereview.services.uploads.impl.DefaultUploadServices = onlineReviewUpload_config.xml
1111
com.cronos.onlinereview.services.uploads.impl.DefaultUploadExternalServices = onlineReviewUpload_config.xml
1212
com.topcoder.servlet.request.LocalFileUpload = onlineReviewUpload_config.xml
13+
com.topcoder.servlet.request.LocalStudioFileUpload = onlineReviewUpload_config.xml
1314

1415
com.topcoder.project.service.ProjectServicesFactory = projectServices_config.xml
1516
com.topcoder.project.service.impl.ProjectServicesImpl = projectServices_config.xml

conf/objectFactory_config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,7 @@
10101010
upload.resource_id AS resource_id,
10111011
upload.project_phase_id AS project_phase_id,
10121012
upload.parameter AS upload_parameter,
1013+
upload.url AS upload_url,
10131014
upload_type_lu.upload_type_id AS upload_type_id,
10141015
upload_type_lu.create_user AS upload_type_create_user,
10151016
upload_type_lu.create_date AS upload_type_create_date,

conf/onlineReviewUpload_config.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,24 @@
6464
<Value>false</Value>
6565
</Property>
6666
</Config>
67+
<!--
68+
=============== Configuration for File Upload component ===============
69+
-->
70+
<Config name="com.topcoder.servlet.request.LocalStudioFileUpload">
71+
<Property name="single_file_limit">
72+
<Value>-1</Value>
73+
</Property>
74+
<Property name="total_file_limit">
75+
<Value>-1</Value>
76+
</Property>
77+
<Property name="default_dir">
78+
<Value>@studio_file_storage_location@</Value>
79+
</Property>
80+
<Property name="allowed_dirs">
81+
<Value>@studio_file_storage_location@</Value>
82+
</Property>
83+
<Property name="overwrite">
84+
<Value>false</Value>
85+
</Property>
86+
</Config>
6787
</CMConfig>

conf/web/WEB-INF/applicationContext.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@
174174
</constructor-arg>
175175
</bean>
176176

177+
<bean id="studioFileUpload" class="com.topcoder.servlet.request.LocalFileUpload">
178+
<constructor-arg index="0">
179+
<value>com.topcoder.servlet.request.LocalStudioFileUpload</value>
180+
</constructor-arg>
181+
</bean>
182+
177183
<bean id="userPreferenceHome" class="org.springframework.jndi.JndiObjectFactoryBean">
178184
<property name="jndiName" value="com.topcoder.web.ejb.user.UserPreferenceHome"/>
179185
<property name="cache" value="true"/>
@@ -943,21 +949,27 @@
943949
class="com.topcoder.direct.services.view.action.contest.DownloadAllSoftwareSubmissionsAction"
944950
scope="prototype" parent="baseDirectStrutsAction">
945951
<property name="fileUpload" ref="fileUpload"/>
952+
<property name="studioFileUpload" ref="studioFileUpload"/>
946953
<property name="roundType" value="CHECKPOINT" />
954+
<property name="s3Bucket" value="@aws_s3_bucket@"/>
947955
</bean>
948956

949957
<bean id="downloadAllSoftwareFinalSubmissions"
950958
class="com.topcoder.direct.services.view.action.contest.DownloadAllSoftwareSubmissionsAction"
951959
scope="prototype" parent="baseDirectStrutsAction">
952960
<property name="fileUpload" ref="fileUpload"/>
961+
<property name="studioFileUpload" ref="studioFileUpload"/>
953962
<property name="roundType" value="FINAL" />
963+
<property name="s3Bucket" value="@aws_s3_bucket@"/>
954964
</bean>
955965

956966
<bean id="downloadAllCopilotPostingSubmissions"
957967
class="com.topcoder.direct.services.view.action.contest.DownloadAllSoftwareSubmissionsAction"
958968
scope="prototype" parent="baseDirectStrutsAction">
959969
<property name="fileUpload" ref="fileUpload"/>
970+
<property name="studioFileUpload" ref="studioFileUpload"/>
960971
<property name="roundType" value="FINAL" />
972+
<property name="s3Bucket" value="@aws_s3_bucket@"/>
961973
</bean>
962974

963975
<bean id="saveSoftwareCheckpointReviewAction"
@@ -976,6 +988,8 @@
976988
class="com.topcoder.direct.services.view.action.contest.DownloadSoftwareSubmissionAction"
977989
scope="prototype" parent="baseDirectStrutsAction">
978990
<property name="fileUpload" ref="fileUpload"/>
991+
<property name="studioFileUpload" ref="studioFileUpload"/>
992+
<property name="s3Bucket" value="@aws_s3_bucket@"/>
979993
</bean>
980994

981995
<bean id="downloadFinalFix"

0 commit comments

Comments
 (0)