Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add api for available backup list and add .idea in gitignore #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/target
/.settings
/.classpath
/.project
/.settings
/.classpath
/.project
/work
*~
/.idea/
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 24 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>3.43</version>
</parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>3.43</version>
</parent>

<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>thinBackup</artifactId>
Expand All @@ -17,27 +18,27 @@
<name>GPLv3</name>
<distribution>repo</distribution>
<comments>
Copyright (C) 2011 Matthias Steinkogler, Thomas Fürer
Copyright (C) 2011 Matthias Steinkogler, Thomas Fürer

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses.</comments>
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses.</comments>
</license>
</licenses>
<!-- get every artifact through maven.glassfish.org, which proxies all the
artifacts that we need -->

<description>
Backs up the most important global and job specific configuration files.
Backs up the most important global and job specific configuration files.
</description>
<url>https://github.com/jenkinsci/thin-backup-plugin</url>

Expand Down Expand Up @@ -106,13 +107,18 @@
<version>3.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.pipeline-stage-view</groupId>
<artifactId>pipeline-rest-api</artifactId>
<version>2.10</version>
</dependency>
</dependencies>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jenkins.version>1.651.3</jenkins.version>
<java.level>8</java.level>
<!-- <jenkins-test-harness.version>2.13</jenkins-test-harness.version> -->
<!-- <jenkins-test-harness.version>2.13</jenkins-test-harness.version> -->
</properties>

<build>
Expand Down Expand Up @@ -165,4 +171,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@
*/
package org.jvnet.hudson.plugins.thinbackup;

import com.cloudbees.workflow.util.ServeJson;
import hudson.Extension;
import hudson.model.ManagementLink;
import hudson.model.TaskListener;
import jenkins.model.Jenkins;
import jenkins.util.Timer;
import org.jvnet.hudson.plugins.thinbackup.restore.HudsonRestore;
import org.jvnet.hudson.plugins.thinbackup.utils.Utils;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

import java.io.File;
import java.io.IOException;
import java.text.ParseException;
Expand All @@ -25,18 +37,6 @@
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;

import org.jvnet.hudson.plugins.thinbackup.restore.HudsonRestore;
import org.jvnet.hudson.plugins.thinbackup.utils.Utils;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

import hudson.Extension;
import hudson.model.ManagementLink;
import hudson.model.TaskListener;
import jenkins.model.Jenkins;
import jenkins.util.Timer;

/**
* A backup solution for Hudson. Backs up configuration files from Hudson and its jobs.
*
Expand Down Expand Up @@ -174,9 +174,14 @@ public ThinBackupPluginImpl getConfiguration() {
return ThinBackupPluginImpl.getInstance();
}

@ServeJson
public List<String> getAvailableBackups() {
final ThinBackupPluginImpl plugin = ThinBackupPluginImpl.getInstance();
return Utils.getBackupsAsDates(new File(plugin.getExpandedBackupPath()));
}

@ServeJson
public List<String> doAvailableBackups(){
return getAvailableBackups();
}
}