1
0
mirror of https://git.cloudron.io/cloudron/gitea-app synced 2025-09-24 14:07:45 +00:00

Compare commits

...

50 Commits

Author SHA1 Message Date
Girish Ramakrishnan
d675d60e1d Version 1.9.1 2019-01-31 09:37:08 -08:00
Girish Ramakrishnan
07d3c6bfcf Update Gitea to 1.7.1 2019-01-31 09:29:33 -08:00
Girish Ramakrishnan
60f9045cbb Version 1.9.0 2019-01-22 12:59:18 -08:00
Girish Ramakrishnan
a633dcab9a Update Gitea to 1.7.0 2019-01-22 12:45:47 -08:00
Girish Ramakrishnan
435f30cf8c Version 1.8.4 2019-01-16 10:47:09 -08:00
Girish Ramakrishnan
157f500660 Update Gitea to 1.6.4 2019-01-16 10:40:53 -08:00
Girish Ramakrishnan
2eae86ee53 Version 1.8.3 2019-01-10 09:38:37 -08:00
Girish Ramakrishnan
3993229ac3 Update Gitea to 1.6.3 2019-01-10 09:29:23 -08:00
Girish Ramakrishnan
9793215e7c Version 1.8.2 2018-12-26 11:47:58 -08:00
Girish Ramakrishnan
6e04300610 Update gitea to 1.6.2 2018-12-26 09:54:13 -08:00
Girish Ramakrishnan
587235be2b Version 1.8.1 2018-12-10 12:02:41 -08:00
Girish Ramakrishnan
de3369808e Update gitea to 1.6.1 2018-12-10 11:53:26 -08:00
Johannes Zellner
5e99be936a Bump version for 1.6.0 2018-11-23 12:13:37 +01:00
Johannes Zellner
12f58af585 Bump version 2018-11-02 08:55:25 +01:00
Johannes Zellner
9971919cf9 Make tests use a different port to avoid conflicts 2018-11-02 08:53:38 +01:00
Johannes Zellner
65bc13c2b7 Update to 1.5.3 2018-11-02 08:19:31 +01:00
Girish Ramakrishnan
c231b12f2d Version 1.7.1 2018-10-11 08:09:22 -07:00
Girish Ramakrishnan
1265366151 Update Gitea to 1.5.2 2018-10-11 08:03:58 -07:00
Girish Ramakrishnan
278116abdb Version 1.7.0 2018-10-10 20:17:18 -07:00
Girish Ramakrishnan
8a942dc8f7 Use latest base image 2018-10-10 20:09:26 -07:00
Johannes Zellner
1b15db85e3 Avoid nxdomain during tests and always specify app id 2018-09-03 17:44:23 +02:00
Johannes Zellner
d37044f8e0 Bump version for 1.5.1 2018-09-03 17:17:32 +02:00
Girish Ramakrishnan
e7671bd3f2 Version 1.6.0 2018-08-12 10:37:38 -07:00
Girish Ramakrishnan
32cc8175e5 Fix tests 2018-08-12 10:36:17 -07:00
Girish Ramakrishnan
534e4884b4 Update Gitea to 1.5.0 2018-08-12 10:17:14 -07:00
Girish Ramakrishnan
6e1f363b88 Version 1.5.4 2018-08-02 10:15:56 -07:00
Girish Ramakrishnan
3eb57f2c07 Add custom file test 2018-08-02 10:15:05 -07:00
Girish Ramakrishnan
b16095eef5 Set GITEA_CUSTOM 2018-08-02 09:41:19 -07:00
Girish Ramakrishnan
18b3ae6bc2 Version 1.5.3 2018-06-27 10:21:47 -07:00
Girish Ramakrishnan
fbf8e5f953 Update gitea to 1.4.3 2018-06-27 09:50:48 -07:00
Girish Ramakrishnan
106e65df9e Version 1.5.2-1 2018-06-07 17:11:34 -07:00
Girish Ramakrishnan
1b629265fa Version 1.5.2 2018-06-06 16:03:37 -07:00
Girish Ramakrishnan
f9949c11a3 fix api usage 2018-06-06 16:00:51 -07:00
Girish Ramakrishnan
a7e693c4ed Update Gitea to 1.4.2 2018-06-06 15:41:46 -07:00
Girish Ramakrishnan
b00d2aced2 Version 1.5.1 2018-05-05 09:41:08 -07:00
Girish Ramakrishnan
c2419ba46c Fix api use 2018-05-03 09:44:20 -07:00
Girish Ramakrishnan
b39e1850d7 add chromedriver 2018-05-03 09:38:42 -07:00
Girish Ramakrishnan
4d37e33eee Update Gitea to 1.4.1 2018-05-03 09:38:22 -07:00
Johannes Zellner
b86f9c7a20 Ensure the tests work with other instances installed 2018-03-26 12:36:09 +02:00
Johannes Zellner
7fd766b348 Bump version 2018-03-26 12:16:04 +02:00
Girish Ramakrishnan
525327c150 Version 1.4.1 2018-02-19 17:03:24 -08:00
Girish Ramakrishnan
bc658da61e Update Gitea to 1.3.3 2018-02-19 16:56:06 -08:00
Girish Ramakrishnan
25f206ccdb Version 1.4.0 2018-01-18 11:28:31 -08:00
Girish Ramakrishnan
d3553de1a6 Use SMTPS port to send email for Go programs 2018-01-18 11:21:31 -08:00
Girish Ramakrishnan
99379fdbb3 Version 1.3.1 2017-12-14 21:04:37 +05:30
Girish Ramakrishnan
21a9fccd60 Update gitea to 1.3.2 2017-12-14 20:48:44 +05:30
Girish Ramakrishnan
8837d2fd60 Version 1.3.0 2017-12-11 09:07:54 +05:30
Girish Ramakrishnan
a66843c3e3 Version 1.3.0 2017-12-11 08:58:10 +05:30
Girish Ramakrishnan
67403a6d2a Gitea 1.3.1 2017-12-11 08:46:00 +05:30
Dennis Schwerdel
c137f79e9b Version 1.2.0 2017-11-29 21:21:37 +01:00
9 changed files with 391 additions and 50 deletions

196
CHANGELOG
View File

@@ -53,3 +53,199 @@
* Only require one email when validating GPG key (#2266, #2467, #2663) (#2788)
* Fix order of comments (#2835) (#2839)
[1.2.0]
* Update to version 1.3.0
[1.3.0]
* Update to version 1.3.1
* Add documentationUrl
* Sanitize logs for mirror sync (#3057, #3082) (#3078)
* Fix missing branch in release bug (#3108) (#3117)
* Fix repo indexer and submodule bug (#3107) (#3110)
* Fix legacy URL redirects (#3100) (#3106)
* Fix redis session failed (#3086) (#3089)
* Fix issue list branch link broken (#3061) (#3070)
* Fix missing password length check when change password (#3039) (#3071)
[1.3.1]
* Update Gitea to 1.3.2
* Fix run web with -p push failed (#3154) (#3179)
* Fix source download link when no code unit allowed (#3166) (#3169)
* Allow adding collaborators with (fullname) (#3103) (#3168)
* Fix repo links (#3093) (#3163)
* Fix Uninitialized variable in ParsePatch (#3156) (#3162)
* Fix migration order v1.3 (#3157)
* Fix avatar URLs (#3069) (#3143)
[1.4.0]
* Fix email sending (use SMTPS)
[1.4.1]
* Update Gitea to 1.3.3
* Security fixes
* Fix escaping changed title in comments (#3530) (#3535)
* Escape search query display (#3486) (#3489)
* Bug fixes
* Fix repo-transfer-and-team-repo-count bug (#3241) (#3244)
* Open external tracker in blank window, consistently with wiki (#3227) (#3228)
* Change SSL Mode from checkbox to string in admin page (#3208) (#3211)
[1.5.0]
* Update Gitea to 1.4.0
[1.5.1]
* Update Gitea to 1.4.1
* Add “error” as reserved username (#3882) (#3886)
* Do not allow inactive users to access repositories using private key (#3887) (#3889)
* Fix path cleanup in file editor, when initilizing new repository and LFS oids (#3871) (#3873)
* Remove unnecessary allowed safe HTML (#3778) (#3779)
* Correctly check http git access rights for reverse proxy authorized users (#3721) (#3743)
* Fix to use only needed columns from tables to get repository git paths (#3870) (#3883)
* Fix GPG expire time display when time is zero (#3584) (#3884)
* Fix to update only issue last update time when adding a comment (#3855) (#3860)
* Fix repository star count after deleting user (#3781) (#3783)
* Use the active branch for the code tab (#3720) (#3776)
* Set default branch name on first push (#3715) (#3723)
* Show clipboard button if disable HTTP of git protocol (#3773) (#3774)
[1.5.2]
* Update Gitea to 1.4.2
* Adjust z-index for floating labels (#3939) (#3950)
* Add missing token validation on application settings page (#3976) #3978
* Webhook and hook_task clean up (#4006)
* Fix webhook bug of response info is not displayed in UI (#4023)
* Fix writer cannot read bare repo guide (#4033) (#4039)
* Don't force due date to current time (#3830) (#4057)
* Fix wiki redirects (#3919) (#4065)
* Fix attachment ENABLED (#4064) (#4066)
* Added deletion of an empty line at the end of file (#4054) (#4074)
* Use ResolveReference instead of path.Join (#4073)
* Fix #4081 Check for leading / in base before removing it (#4083)
* Respository's home page not updated after first push (#4075)
[1.5.2-1]
* Rebuild Gitea package because of https://github.com/go-gitea/gitea/issues/4167
* Adjust z-index for floating labels (#3939) (#3950)
* Add missing token validation on application settings page (#3976) #3978
* Webhook and hook_task clean up (#4006)
* Fix webhook bug of response info is not displayed in UI (#4023)
* Fix writer cannot read bare repo guide (#4033) (#4039)
* Don't force due date to current time (#3830) (#4057)
* Fix wiki redirects (#3919) (#4065)
* Fix attachment ENABLED (#4064) (#4066)
* Added deletion of an empty line at the end of file (#4054) (#4074)
* Use ResolveReference instead of path.Join (#4073)
* Fix #4081 Check for leading / in base before removing it (#4083)
* Respository's home page not updated after first push (#4075)
[1.5.3]
* Update Gitea to 1.4.3
* SECURITY
* HTML-escape plain-text READMEs (#4192) (#4214)
* Fix open redirect vulnerability on login screen (#4312) (#4312)
* BUGFIXES
* Fix broken monitoring page when running processes are shown (#4203) (#4208)
* Fix delete comment bug (#4216) (#4228)
* Delete reactions added to issues and comments when deleting repository (#4232) (#4237)
* Fix wiki URL encoding bug (#4091) (#4254)
* Fix code tab link when viewing tags (#3908) (#4263)
* Fix webhook type conflation (#4285) (#4285)
[1.5.4]
* Allow customization using gitea's custom data directory
[1.6.0]
* Update Gitea to 1.5.0
* Security
* Check that repositories can only be migrated to own user or organizations (#4366) (#4370)
* Limit uploaded avatar image-size to 4096px x 3072px by default (#4353)
* Do not allow to reuse TOTP passcode (#3878)
* Features
* Add cli commands to regen hooks & keys (#3979)
* Add support for FIDO U2F (#3971)
* Added user language setting (#3875)
* Add topic support (#3711)
* Multiple assignees (#3705)
* Add protected branch whitelists for merging (#3689)
* Global code search support (#3664)
* Add label descriptions (#3662)
* Add issue search via API (#3612)
* Add repository setting to enable/disable health checks (#3607)
* Emoji Autocomplete (#3433)
* Implements generator cli for secrets (#3531)
[1.6.1]
* Update Gitea to 1.5.1
* Security
* Don't disclose emails of all users when sending out emails (#4784)
* Improve URL validation for external wiki and external issues (#4710) (#4740)
* Make cookies HttpOnly and obey COOKIE_SECURE flag (#4706) (#4707)
* Bugfixes
* Fix missing release title in webhook (#4783) (#4800)
* Make sure to reset commit count in the cache on mirror syncing (#4770)
* Fixed bug where team with admin privelege type doesn't get any unit (#4759)
* Fix failure on creating pull request with assignees (#4583) (#4727)
* Hide org/create menu item in Dashboard if user has no rights (#4678) (#4686)
[1.7.0]
* Update base image
[1.7.1]
* Update Gitea to 1.5.2
[1.7.2]
* Update Gitea to 1.5.3
* Security
* Fix remote command execution vulnerability in upstream library (#5177) (#5196)
[1.8.0]
* Update Gitea to 1.6.0
[1.8.1]
* Update Gitea to 1.6.1
[1.8.2]
* Update Gitea to 1.6.2
* SECURITY
* Sanitize uploaded file names (#5571) (#5573)
* HTMLEncode user added text (#5570) (#5575)
* BUGFIXES
* Fix indexer reindex bug when gitea restart (#5563) (#5564)
* Fix bug when a read perm user to edit his issue (#5516) (#5534)
* Detect force push failure on deletion of protected branches (#5522) (#5531)
* Fix forgot deletion of notification when delete repository (#5506) (#5514)
* Fix undeleted content when deleting user (#5429) (#5509)
* Fix empty wiki (#5504) (#5508)
[1.8.3]
* Update Gitea to 1.6.3
* SECURITY: Prevent DeleteFilePost doing arbitrary deletion (#5631)
* BUGFIX: Fix wrong text getting saved on editing second comment on an issue (#5608)
[1.8.4]
* Update Gitea to 1.6.4
* Fix SSH key now can be reused as public key after deleting as deploy key (#5671) (#5685)
* When redirecting clean the path to avoid redirecting to external site (#5669) (#5703)
* Fix to use correct value for "MSpan Structures Obtained" (#5706) (#5715)
[1.9.0]
* Update Gitea to 1.7.0
[1.9.1]
* Update Gitea to 1.7.1
* [Changelog](https://github.com/go-gitea/gitea/releases/tag/v1.7.1)
* Disable redirect for i18n (#5910) (#5916)
* Only allow local login if password is non-empty (#5906) (#5908)
* Fix go-get URL generation (#5905) (#5907)
* Fix TLS errors when using acme/autocert for local connections (#5820) (#5826)
* Request for public keys only if LDAP attribute is set (#5816) (#5819)
* Fix delete correct temp directory (#5840) (#5839)
* Fix an error while adding a dependency via UI (#5862) (#5876)
* Fix null pointer in attempt to Sudo if not logged in (#5872) (#5884)
* When creating new repository fsck option should be enabled (#5817) (#5885)
* Prevent nil dereference in mailIssueCommentToParticipants (#5891) (#5895) (#5894)
* Fix bug when read public repo lfs file (#5913) (#5912)
* Respect value of REQUIRE_SIGNIN_VIEW (#5901) (#5915)
* Fix compare button on upstream repo leading to 404 (#5877) (#5914)

View File

@@ -4,7 +4,7 @@
"author": "Gitea developers",
"description": "file://DESCRIPTION.md",
"tagline": "A painless self-hosted Git Service",
"version": "1.1.3",
"version": "1.9.1",
"healthCheckPath": "/healthcheck",
"httpPort": 3000,
"addons": {
@@ -33,5 +33,7 @@
],
"tags": [ "version control", "git", "code hosting", "development" ],
"changelog": "file://CHANGELOG",
"postInstallMessage": "file://POSTINSTALL.md"
"postInstallMessage": "file://POSTINSTALL.md",
"minBoxVersion": "1.10.0",
"documentationUrl": "https://cloudron.io/documentation/apps/gitea/"
}

View File

@@ -1,4 +1,4 @@
This app packages Gitea <upstream>1.2.3</upstream>
This app packages Gitea <upstream>1.7.1</upstream>
Gitea is a painless self-hosted Git service. It is similar to GitHub, Bitbucket or Gitlab.

View File

@@ -1,6 +1,4 @@
FROM cloudron/base:0.10.0
ENV VERSION 1.2.3
FROM cloudron/base:1.0.0@sha256:147a648a068a2e746644746bbfb42eb7a50d682437cead3c67c933c546357617
RUN apt-get update && \
apt-get install -y openssh-server git && \
@@ -15,8 +13,7 @@ RUN adduser --disabled-login --gecos 'Gitea' git
RUN passwd -d git
RUN mkdir -p /home/git/gitea
## TODO: use redis as well
RUN curl -L https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-linux-amd64 -o /home/git/gitea/gitea \
RUN curl -L https://dl.gitea.io/gitea/1.7.1/gitea-1.7.1-linux-amd64 -o /home/git/gitea/gitea \
&& chmod +x /home/git/gitea/gitea
# setup config paths
@@ -31,9 +28,7 @@ RUN ln -s /app/data/gitconfig /home/git/.gitconfig
ADD start.sh /home/git/start.sh
# disable pam authentication for sshd
RUN sed -e 's/UsePAM yes/UsePAM no/' -e 's/UsePrivilegeSeparation yes/UsePrivilegeSeparation no/' -i /etc/ssh/sshd_config
RUN echo "UseDNS no" >> /etc/ssh/sshd_config
COPY sshd_config /etc/ssh/sshd_config
CMD [ "/home/git/start.sh" ]

79
sshd_config Normal file
View File

@@ -0,0 +1,79 @@
# Package generated configuration file
# See the sshd_config(5) manpage for details
# What ports, IPs and protocols we listen for
Port 29418
# Use these options to restrict which interfaces/protocols sshd will bind to
ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /app/data/sshd/ssh_host_rsa_key
HostKey /app/data/sshd/ssh_host_dsa_key
HostKey /app/data/sshd/ssh_host_ecdsa_key
HostKey /app/data/sshd/ssh_host_ed25519_key
# Logging
SyslogFacility AUTH
LogLevel INFO
# Authentication:
LoginGraceTime 120
PermitRootLogin prohibit-password
StrictModes yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys
# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no
# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM no
UseDNS no

View File

@@ -2,7 +2,7 @@
set -eu -o pipefail
mkdir -p /run/gitea/tmp/uploads
mkdir -p /run/gitea/tmp/uploads /run/sshd
setup_ldap_source() {
set -eu
@@ -50,10 +50,7 @@ fi
chmod 0600 /app/data/sshd/*_key
chmod 0644 /app/data/sshd/*.pub
sed -e "s/^Port .*/Port ${SSH_PORT}/" \
-e "s/^#ListenAddress .*/ListenAddress 0.0.0.0/" \
-e "s,^HostKey /etc/ssh/,HostKey /app/data/sshd/," \
/etc/ssh/sshd_config > /run/gitea/sshd_config
sed -e "s/^Port .*/Port ${SSH_PORT}/" /etc/ssh/sshd_config > /run/gitea/sshd_config
cp /home/git/app.ini.template "/run/gitea/app.ini"
@@ -87,7 +84,7 @@ crudini --set "/run/gitea/app.ini" server SSH_PORT "${SSH_PORT}"
crudini --set "/run/gitea/app.ini" server APP_DATA_PATH "/app/data/appdata"
crudini --set "/run/gitea/app.ini" repository ROOT "/app/data/repository"
crudini --set "/run/gitea/app.ini" repository.upload TEMP_PATH "/run/gitea/tmp/uploads"
crudini --set "/run/gitea/app.ini" mailer HOST "${MAIL_SMTP_SERVER}:${MAIL_SMTP_PORT}"
crudini --set "/run/gitea/app.ini" mailer HOST "${MAIL_SMTP_SERVER}:${MAIL_SMTPS_PORT}"
crudini --set "/run/gitea/app.ini" mailer USER "${MAIL_SMTP_USERNAME}"
crudini --set "/run/gitea/app.ini" mailer PASSWD "${MAIL_SMTP_PASSWORD}"
crudini --set "/run/gitea/app.ini" mailer FROM "${MAIL_FROM}"
@@ -97,8 +94,7 @@ crudini --set "/run/gitea/app.ini" log MODE "console"
crudini --set "/run/gitea/app.ini" log ROOT_PATH "/run/gitea"
crudini --set "/run/gitea/app.ini" indexer ISSUE_INDEXER_PATH "/app/data/appdata/indexers/issues.bleve"
mkdir -p /app/data/repository /app/data/ssh
mkdir -p /app/data/repository /app/data/ssh /app/data/custom
chown -R git:git /app/data /run/gitea

View File

@@ -9,4 +9,4 @@ stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
environment=HOME="/home/git",USER="git"
environment=HOME="/home/git",USER="git",GITEA_CUSTOM="/app/data/custom"

View File

@@ -17,6 +17,7 @@
"superagent": "^1.4.0"
},
"dependencies": {
"chromedriver": "^2.38.2",
"selenium-server-standalone-jar": "^3.3.1",
"selenium-webdriver": "^3.3.0",
"superagent": "^1.8.5"

View File

@@ -9,6 +9,8 @@
'use strict';
require('chromedriver');
var execSync = require('child_process').execSync,
ejs = require('ejs'),
expect = require('expect.js'),
@@ -29,6 +31,7 @@ describe('Application life cycle test', function () {
this.timeout(0);
var server, browser = new Builder().forBrowser('chrome').build();
var LOCATION = 'test';
var SSH_PORT = 29420;
var repodir = '/tmp/testrepo';
var app, reponame = 'testrepo';
var username = process.env.USERNAME;
@@ -71,7 +74,7 @@ describe('Application life cycle test', function () {
expect(app).to.be.an('object');
}
function setAvatar(done) {
function setAvatarOld(done) {
browser.get('https://' + app.fqdn + '/user/settings/avatar').then(function () {
return browser.findElement(by.xpath('//input[@type="file" and @name="avatar"]')).sendKeys(path.resolve(__dirname, '../logo.png'));
}).then(function () {
@@ -87,6 +90,25 @@ describe('Application life cycle test', function () {
});
}
function setAvatar(done) {
if (app.manifest.version === '1.5.4') return setAvatarOld(done);
browser.get('https://' + app.fqdn + '/user/settings').then(function () {
var button = browser.findElement(by.xpath('//label[contains(text(), "Use Custom Avatar")]'));
return browser.executeScript('arguments[0].scrollIntoView(false)', button);
}).then(function () {
return browser.findElement(by.xpath('//label[contains(text(), "Use Custom Avatar")]')).click();
}).then(function () {
return browser.findElement(by.xpath('//input[@type="file" and @name="avatar"]')).sendKeys(path.resolve(__dirname, '../logo.png'));
}).then(function () {
return browser.findElement(by.xpath('//button[contains(text(), "Update Avatar")]')).click();
}).then(function () {
return browser.wait(until.elementLocated(by.xpath('//p[contains(text(),"Your avatar has been updated.")]')), TIMEOUT);
}).then(function () {
done();
});
}
function checkAvatar(done) {
return done();
superagent.get('https://' + app.fqdn + '/avatars/a3e6f3316fc1738e29d621e6a26e93d3').end(function (error, result) {
@@ -106,7 +128,7 @@ return done();
}).then(function () {
return browser.findElement(by.xpath('//button[contains(text(), "Commit Changes")]')).click();
}).then(function () {
waitForUrl('https://' + app.fqdn + '/' + username + '/' + reponame + '/src/master/newfile', done);
waitForUrl('https://' + app.fqdn + '/' + username + '/' + reponame + '/src/branch/master/newfile', done);
});
}
@@ -127,12 +149,7 @@ return done();
function addPublicKey(done) {
var publicKey = fs.readFileSync(__dirname + '/id_rsa.pub', 'utf8');
var sshPage;
if (app.manifest.version === '1.0.3') {
sshPage = 'https://' + app.fqdn + '/user/settings/ssh';
} else {
sshPage = 'https://' + app.fqdn + '/user/settings/keys';
}
const sshPage = 'https://' + app.fqdn + '/user/settings/keys';
browser.get(sshPage).then(function () {
return browser.findElement(by.xpath('//div[text()="Add Key"]')).click();
@@ -194,7 +211,7 @@ return done();
}).then(function () {
return browser.findElement(by.id('repo-clone-url')).getAttribute('value');
}).then(function (cloneUrl) {
expect(cloneUrl).to.be('ssh://git@' + app.fqdn + ':29418/' + username + '/' + reponame + '.git');
expect(cloneUrl).to.be(`ssh://git@${app.fqdn}:${SSH_PORT}/${username}/${reponame}.git`);
done();
});
}
@@ -203,23 +220,55 @@ return done();
rimraf.sync(repodir);
var env = Object.create(process.env);
env.GIT_SSH = __dirname + '/git_ssh_wrapper.sh';
execSync('git clone ssh://git@' + app.fqdn + ':29418/' + username + '/' + reponame + '.git ' + repodir, { env: env });
execSync(`git clone ssh://git@${app.fqdn}:${SSH_PORT}/${username}/${reponame}.git ${repodir}`, { env: env });
done();
}
function pushFile(done) {
var env = Object.create(process.env);
env.GIT_SSH = __dirname + '/git_ssh_wrapper.sh';
execSync('touch newfile && git add newfile && git commit -a -mx && git push ssh://git@' + app.fqdn + ':29418/' + username + '/' + reponame + ' master',
execSync(`touch newfile && git add newfile && git commit -a -mx && git push ssh://git@${app.fqdn}:${SSH_PORT}/${username}/${reponame} master`,
{ env: env, cwd: repodir });
rimraf.sync('/tmp/testrepo');
done();
}
function addCustomFile(done) {
fs.writeFileSync('/tmp/customfile.txt', 'GOGS TEST', 'utf8');
execSync(`cloudron exec --app ${app.id} -- mkdir -p /app/data/custom/public`);
execSync(`cloudron push --app ${app.id} /tmp/customfile.txt /app/data/custom/public/customfile.txt`);
fs.unlinkSync('/tmp/customfile.txt');
done();
}
function checkCustomFile(done) {
superagent.get('https://' + app.fqdn + '/customfile.txt').end(function (error, result) {
if (error) return done(error);
expect(result.text).to.contain('GOGS TEST');
done();
});
}
function fileExists() {
expect(fs.existsSync(repodir + '/newfile')).to.be(true);
}
function sendMail(done) {
browser.get(`https://${app.fqdn}/admin/config`).then(function () {
var button = browser.findElement(by.xpath('//button[@id="test-mail-btn"]'));
return browser.executeScript('arguments[0].scrollIntoView(true)', button);
}).then(function () {
return browser.findElement(by.xpath('//input[@name="email"]')).sendKeys('test@cloudron.io');
}).then(function () {
return browser.findElement(by.xpath('//button[@id="test-mail-btn"]')).click();
}).then(function () {
return browser.wait(until.elementLocated(by.xpath('//p[contains(text(),"A testing email has been sent to \'test@cloudron.io\'")]')), TIMEOUT);
}).then(function () {
done();
});
}
xit('build app', function () {
execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
});
@@ -227,16 +276,16 @@ return done();
it('can login', function (done) {
var inspect = JSON.parse(execSync('cloudron inspect'));
superagent.post('https://' + inspect.apiEndpoint + '/api/v1/developer/login').send({
superagent.post(`https://${inspect.apiEndpoint}/api/v1/developer/login`).send({
username: username,
password: password
}).end(function (error, result) {
if (error) return done(error);
if (result.statusCode !== 200) return done(new Error('Login failed with status ' + result.statusCode));
token = result.body.token;
token = result.body.accessToken;
superagent.get('https://' + inspect.apiEndpoint + '/api/v1/profile')
superagent.get(`https://${inspect.apiEndpoint}/api/v1/profile`)
.query({ access_token: token }).end(function (error, result) {
if (error) return done(error);
if (result.statusCode !== 200) return done(new Error('Get profile failed with status ' + result.statusCode));
@@ -248,7 +297,7 @@ return done();
});
it('install app', function () {
execSync('cloudron install --new --wait --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
execSync(`cloudron install --new --wait --location ${LOCATION} -p SSH_PORT=${SSH_PORT}`, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
});
it('can get app information', getAppInfo);
@@ -262,6 +311,7 @@ return done();
});
it('can login', login);
it('can send mail', sendMail);
it('can set avatar', setAvatar);
it('can get avatar', checkAvatar);
@@ -276,8 +326,11 @@ return done();
it('can add and push a file', pushFile);
it('can edit file', editFile);
it('can add custom file', addCustomFile);
it('can check custom file', checkCustomFile);
it('can restart app', function (done) {
execSync('cloudron restart --wait');
execSync('cloudron restart --wait --app ' + app.id);
done();
});
@@ -299,12 +352,17 @@ return done();
it('can clone the url', cloneRepo);
it('file exists in repo', function () { expect(fs.existsSync(repodir + '/newfile')).to.be(true); });
it('move to different location', function () {
browser.manage().deleteAllCookies();
execSync('cloudron configure --wait --location ' + LOCATION + '2', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
var inspect = JSON.parse(execSync('cloudron inspect'));
app = inspect.apps.filter(function (a) { return a.location === LOCATION + '2'; })[0];
expect(app).to.be.an('object');
it('move to different location', function (done) {
//browser.manage().deleteAllCookies(); // commented because of error "'Network.deleteCookie' wasn't found"
// ensure we don't hit NXDOMAIN in the mean time
browser.get('about:blank').then(function () {
execSync('cloudron configure --wait --location ' + LOCATION + '2 --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
var inspect = JSON.parse(execSync('cloudron inspect'));
app = inspect.apps.filter(function (a) { return a.location === LOCATION + '2'; })[0];
expect(app).to.be.an('object');
done();
});
});
it('can login', login);
@@ -313,13 +371,17 @@ return done();
it('can clone the url', cloneRepo);
it('file exists in repo', function () { expect(fs.existsSync(repodir + '/newfile')).to.be(true); });
it('uninstall app', function () {
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
it('uninstall app', function (done) {
// ensure we don't hit NXDOMAIN in the mean time
browser.get('about:blank').then(function () {
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
done();
});
});
// check if the _first_ login via email succeeds
it('can login via email', function (done) {
execSync('cloudron install --new --wait --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
execSync(`cloudron install --new --wait --location ${LOCATION} -p SSH_PORT=${SSH_PORT}`, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
var inspect = JSON.parse(execSync('cloudron inspect'));
app = inspect.apps.filter(function (a) { return a.location === LOCATION; })[0];
@@ -327,14 +389,18 @@ return done();
login(function (error) {
if (error) return done(error);
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
done();
// ensure we don't hit NXDOMAIN in the mean time
browser.get('about:blank').then(function () {
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
done();
});
});
});
// test update
it('can install app', function () {
execSync('cloudron install --new --wait --appstore-id ' + app.manifest.id + ' --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
execSync(`cloudron install --new --wait --appstore-id ${app.manifest.id} --location ${LOCATION} -p SSH_PORT=${SSH_PORT}`, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
});
it('can get app information', getAppInfo);
@@ -350,11 +416,17 @@ return done();
execSync('cloudron install --wait --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
});
it('can login', login);
it('can send mail', sendMail);
it('can get avatar', checkAvatar);
it('can clone the url', cloneRepo);
it('file exists in cloned repo', fileExists);
it('uninstall app', function () {
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
it('uninstall app', function (done) {
// ensure we don't hit NXDOMAIN in the mean time
browser.get('about:blank').then(function () {
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
done();
});
});
});