Skip to content

Commit e66cdd8

Browse files
committed
Lots more work on UI.
One can now: - add/remove artifact filters - browse <RepoName>/pool/ - delete a repository Other tidy ups: - Added license - update plugin details
1 parent 1797344 commit e66cdd8

34 files changed

Lines changed: 1355 additions & 265 deletions

LICENSE.txt

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
Apache License
2+
3+
Version 2.0, January 2004
4+
5+
http://www.apache.org/licenses/
6+
7+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8+
9+
1. Definitions.
10+
11+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
12+
13+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
14+
15+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
16+
17+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
18+
19+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
20+
21+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
22+
23+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
24+
25+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
26+
27+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
28+
29+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
30+
31+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
32+
33+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
34+
35+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
36+
37+
You must give any other recipients of the Work or Derivative Works a copy of this License; and
38+
39+
You must cause any modified files to carry prominent notices stating that You changed the files; and
40+
41+
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
42+
43+
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44+
45+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46+
47+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48+
49+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50+
51+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52+
53+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
54+
55+
END OF TERMS AND CONDITIONS
56+
57+
APPENDIX: How to apply the Apache License to your work
58+
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
59+
60+
Copyright [yyyy] [name of copyright owner]
61+
62+
Licensed under the Apache License, Version 2.0 (the "License");
63+
you may not use this file except in compliance with the License.
64+
You may obtain a copy of the License at
65+
66+
http://www.apache.org/licenses/LICENSE-2.0
67+
68+
Unless required by applicable law or agreed to in writing, software
69+
distributed under the License is distributed on an "AS IS" BASIS,
70+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
71+
See the License for the specific language governing permissions and
72+
limitations under the License.

TodoList.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Stuff to do
2+
3+
In order of urgency
4+
5+
- [x] Add pool browsing
6+
- [ ] Tidy up editRepository.jsp heading
7+
- [ ] Add rename and project edit dialog to edit screen and validate repo name to be URL friendly
8+
- [ ] Unpack deb file in an emphemeral dir to avoid conflicts, and then cleanup.
9+
- [x] Test with packages that are not in the root of the artifact list.
10+
- [ ] Add filter count to statistics
11+
- [x] Add license file to github
12+
- [ ] Migrate to DB.
13+
- [ ] Handle case were editing a repository that has been deleted returns empty response (and error popup).
14+
- [ ] Refactor Dialog classes into single class in javascript.
15+
- [ ] Add artifact chooser (like build editing screen has)
16+
- [ ] Add regex test to filter edit dialog.
17+
- [ ] Packages file should be nice list rather than just text file.
18+
- [ ] List content counts on "directories" while browsing repo.
19+
- [ ] List content size/modified date if a file while browsing repo.

readme.txt renamed to readme.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

2-
TeamCity server-side plugin
2+
3+
# tcDebrepository - A TeamCity plugin to serve package updates to Debian/Ubuntu servers
4+
35

46
This is an empty project to develop TeamCity plugin that operates on server-side only.
57

tcdebrepo-server/RespositoryNotes.md

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -22,46 +22,45 @@ Example:
2222
http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu/dists/zesty/InRelease
2323

2424
## Debian Repository Layout diagram.
25-
26-
{RepositoryName}
27-
|
28-
-- pool
29-
| |
30-
| -- {componentName}, eg, main
31-
| |
32-
| -- /some/dir/debfilename1.deb
33-
| -- /some/dir/debfilename2.deb
34-
| -- /some/dir/debfilename3.deb
35-
|
36-
|
37-
-- dists
38-
|
39-
-- {distName}, eg, trusty
40-
| |
41-
| -- InRelease
42-
| -- Release
43-
| -- Release.gpg
44-
| -- {componentName}, eg main
45-
| |
46-
| -- {archName}, eg binary-amd64
47-
| |
48-
| -- Packages.bz2
49-
| -- Packages.gz
50-
| -- Packages (not required, but useful for debugging)
51-
| -- Release (optional)
52-
|
53-
| -- {archName}, eg binary-i386
54-
| |
55-
| -- Packages.bz2
56-
| -- Packages.gz
57-
| -- Packages (not required, but useful for debugging)
58-
| -- Release (optional)
59-
|
60-
| -- {archName}, eg source
61-
| |
62-
| -- Packages.bz2
63-
| -- Packages.gz
64-
| -- Packages (not required, but useful for debugging)
65-
| -- Release (optional)
66-
|
67-
-- {distname}, eg, zesty
25+
{RepositoryName}
26+
|
27+
-- pool
28+
| |
29+
| -- {componentName}, eg, main
30+
| |
31+
| -- /some/dir/debfilename1.deb
32+
| -- /some/dir/debfilename2.deb
33+
| -- /some/dir/debfilename3.deb
34+
|
35+
|
36+
-- dists
37+
|
38+
-- {distName}, eg, trusty
39+
| |
40+
| -- InRelease
41+
| -- Release
42+
| -- Release.gpg
43+
| -- {componentName}, eg main
44+
| |
45+
| -- {archName}, eg binary-amd64
46+
| |
47+
| -- Packages.bz2
48+
| -- Packages.gz
49+
| -- Packages (not required, but useful for debugging)
50+
| -- Release (optional)
51+
|
52+
| -- {archName}, eg binary-i386
53+
| |
54+
| -- Packages.bz2
55+
| -- Packages.gz
56+
| -- Packages (not required, but useful for debugging)
57+
| -- Release (optional)
58+
|
59+
| -- {archName}, eg source
60+
| |
61+
| -- Packages.bz2
62+
| -- Packages.gz
63+
| -- Packages (not required, but useful for debugging)
64+
| -- Release (optional)
65+
|
66+
-- {distname}, eg, zesty

tcdebrepo-server/pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@
6565
<!-- <version>0.7.1</version> -->
6666
<version>0.8.0-SNAPSHOT</version>
6767
</dependency>
68+
69+
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
70+
<dependency>
71+
<groupId>org.apache.commons</groupId>
72+
<artifactId>commons-lang3</artifactId>
73+
<version>3.5</version>
74+
</dependency>
75+
76+
6877

6978
<!-- https://mvnrepository.com/artifact/org.springframework/spring-test -->
7079
<dependency>

tcdebrepo-server/src/main/java/debrepo/teamcity/entity/DebPackageStore.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ public List<DebPackageEntity> findAllForPackageName(String packageName) {
8787
}
8888
return debs;
8989
}
90+
91+
public List<DebPackageEntity> findAllForPackageNameAndComponent(String packageName, String component) {
92+
List<DebPackageEntity> debs = new ArrayList<>();
93+
for (DebPackageEntity deb: this.values()){
94+
if (deb.getPackageName().equalsIgnoreCase(packageName) && deb.getComponent().equalsIgnoreCase(component)){
95+
debs.add(deb);
96+
}
97+
}
98+
return debs;
99+
}
90100

91101
public List<DebPackageEntity> findAllForPackageNameAndVersion(String packageName, String version) {
92102
List<DebPackageEntity> debs = new ArrayList<>();

tcdebrepo-server/src/main/java/debrepo/teamcity/entity/DebRepositoryBuildTypeConfig.java

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,13 @@ public boolean addFilter(Filter filter) {
8080
return this.debFilters.add(filter);
8181
}
8282

83-
public boolean removeFilter(String filter) {
84-
return this.debFilters.remove(filter);
83+
public boolean removeFilter(String id) {
84+
for (Filter f : this.debFilters) {
85+
if (id.equals(f.getId())) {
86+
return this.debFilters.remove(f);
87+
}
88+
}
89+
return false;
8590
}
8691

8792
/**
@@ -107,7 +112,7 @@ public List<Filter> matchAgainstFilter(String filename) {
107112
/* Use the XmlAttributes on the fields rather than the getters
108113
* and setters provided by Lombok */
109114
@XmlAccessorType(XmlAccessType.FIELD)
110-
@XmlRootElement @AllArgsConstructor @NoArgsConstructor @Data
115+
@XmlRootElement @NoArgsConstructor @Data
111116
@XmlType(propOrder = { "regex", "dist", "component", "id" })
112117
public static class Filter implements Comparable<Filter>{
113118
@XmlTransient
@@ -117,19 +122,26 @@ public static class Filter implements Comparable<Filter>{
117122
@XmlTransient
118123
final int AFTER = 1;
119124

120-
@XmlAttribute
125+
@XmlAttribute @NotNull
121126
private String id = UUID.randomUUID().toString();
122127

123-
@XmlAttribute
128+
@XmlAttribute @NotNull
124129
private String regex;
125130

126-
@XmlAttribute
131+
@XmlAttribute @NotNull
127132
private String dist;
128133

129-
@XmlAttribute
134+
@XmlAttribute @NotNull
130135
private String component;
131136

132-
public Filter(String regex, String dist, String component) {
137+
public Filter(@NotNull String id, @NotNull String regex, @NotNull String dist, @NotNull String component) {
138+
this.id = id;
139+
this.regex = regex;
140+
this.dist = dist;
141+
this.component = component;
142+
}
143+
144+
public Filter(@NotNull String regex, @NotNull String dist, @NotNull String component) {
133145
this(UUID.randomUUID().toString(), regex, dist, component);
134146
}
135147

@@ -140,10 +152,7 @@ public boolean matches(String filename) {
140152
@Override
141153
public int compareTo(Filter o) {
142154

143-
int comparison = this.id.compareTo(o.getId());
144-
if (comparison != EQUAL) return comparison;
145-
146-
comparison = this.dist.compareTo(o.getDist());
155+
int comparison = this.dist.compareTo(o.getDist());
147156
if (comparison != EQUAL) return comparison;
148157

149158
comparison = this.component.compareTo(o.getComponent());
@@ -152,6 +161,9 @@ public int compareTo(Filter o) {
152161
comparison = this.regex.compareTo(o.getRegex());
153162
if (comparison != EQUAL) return comparison;
154163

164+
comparison = this.id.compareTo(o.getId());
165+
if (comparison != EQUAL) return comparison;
166+
155167
assert this.equals(o) : "DebRepositoryBuildTypeConfig.Filter :: compareTo inconsistant with equals";
156168

157169
return EQUAL;

tcdebrepo-server/src/main/java/debrepo/teamcity/entity/DebRepositoryConfigurationJaxImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.util.ArrayList;
1919
import java.util.List;
2020
import java.util.UUID;
21+
import java.util.concurrent.CopyOnWriteArrayList;
2122

2223
import javax.xml.bind.annotation.XmlAccessType;
2324
import javax.xml.bind.annotation.XmlAccessorType;
@@ -53,7 +54,7 @@ public class DebRepositoryConfigurationJaxImpl implements DebRepositoryConfigura
5354
private String repoName;
5455

5556
@XmlElement(name="build-type") @XmlElementWrapper(name="build-types")
56-
private List<DebRepositoryBuildTypeConfig> buildTypes = new ArrayList<>();
57+
private List<DebRepositoryBuildTypeConfig> buildTypes = new CopyOnWriteArrayList<>();
5758

5859
public DebRepositoryConfigurationJaxImpl(String projectId, String repoName) {
5960
this.projectId = projectId;

tcdebrepo-server/src/main/java/debrepo/teamcity/service/DebRepositoryBuildArtifactsPublisher.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@
2121
public interface DebRepositoryBuildArtifactsPublisher {
2222

2323
public abstract void addArtifactsToRepositories(SBuild build, BuildArtifacts buildArtifacts);
24+
public abstract void removeArtifactsFromRepositories(SBuild build, BuildArtifacts buildArtifacts);
2425

2526
}

tcdebrepo-server/src/main/java/debrepo/teamcity/service/DebRepositoryBuildArtifactsPublisherImpl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ public DebRepositoryBuildArtifactsPublisherImpl(DebRepositoryManager debReposito
4949
this.myDebFileReaderFactory = debFileReaderFactory;
5050
Loggers.SERVER.info("DebRepositoryBuildArtifactsPublisherImpl :: Starting");
5151
}
52+
53+
54+
@Override
55+
public void removeArtifactsFromRepositories(SBuild build, BuildArtifacts buildArtifacts) {
56+
// TODO Auto-generated method stub
57+
58+
}
5259

5360
@Override
5461
public void addArtifactsToRepositories(SBuild build, BuildArtifacts buildArtifacts) {

0 commit comments

Comments
 (0)