This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch SLING-11097
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-committer-cli.git

commit 768bd6aa420cc96a5f19c945a3ae0ae87681afd5
Author: Dan Klco <[email protected]>
AuthorDate: Thu Jan 27 20:45:05 2022 -0500

    SLING-11097 - Adding a fallback to the CI validator to check the parent 
commit if the tag does not have a build status
---
 .../sling/cli/impl/ci/CIStatusValidator.java       |  55 +++++---
 .../sling/cli/impl/ci/CIStatusValidatorTest.java   | 148 +++++++++++++-------
 src/test/resources/ci/parent-status.json           | 149 +++++++++++++++++++++
 src/test/resources/ci/tag-commit.json              | 123 +++++++++++++++++
 src/test/resources/ci/tag-status.json              |  75 +++++++++++
 src/test/resources/ci/tag-test.pom                 |  83 ++++++++++++
 6 files changed, 563 insertions(+), 70 deletions(-)

diff --git a/src/main/java/org/apache/sling/cli/impl/ci/CIStatusValidator.java 
b/src/main/java/org/apache/sling/cli/impl/ci/CIStatusValidator.java
index 9e2e924..25ca1c0 100644
--- a/src/main/java/org/apache/sling/cli/impl/ci/CIStatusValidator.java
+++ b/src/main/java/org/apache/sling/cli/impl/ci/CIStatusValidator.java
@@ -33,6 +33,9 @@ import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
 
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+
 import org.apache.http.HttpHeaders;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpGet;
@@ -46,14 +49,12 @@ import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-
 @Component(service = CIStatusValidator.class)
 public class CIStatusValidator {
 
+    private static final String PN_STATE = "state";
+    private static final String PN_PARENTS = "parents";
+
     public static class ValidationResult {
         private final String message;
         private final boolean valid;
@@ -80,9 +81,9 @@ public class CIStatusValidator {
 
     private XPathFactory xPathFactory = XPathFactory.newInstance();
 
-    protected JsonObject fetchCIStatus(String ciEndpoint) throws IOException {
+    protected JsonObject fetchJson(String endpoint) throws IOException {
         try (CloseableHttpClient client = httpClientFactory.newClient()) {
-            HttpGet get = new HttpGet(ciEndpoint);
+            HttpGet get = new HttpGet(endpoint);
             get.addHeader(HttpHeaders.ACCEPT, "application/json");
             try (CloseableHttpResponse response = client.execute(get)) {
                 try (InputStream content = response.getEntity().getContent()) {
@@ -94,11 +95,13 @@ public class CIStatusValidator {
         }
     }
 
-    String getCIEndpoint(Path artifactFilePath) {
-        log.trace("getCIEndpoint");
+    String getCIStatusEndpoint(Path artifactFilePath) {
+        log.trace("getCIStatusEndpoint");
         String ciEndpoint = null;
         try {
+            
builderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl";,
 true);
             DocumentBuilder builder = builderFactory.newDocumentBuilder();
+
             Document xmlDocument = builder.parse(artifactFilePath.toFile());
             XPath xPath = xPathFactory.newXPath();
             String repositoryName = (String) 
xPath.compile("/project/scm/url/text()").evaluate(xmlDocument, 
XPathConstants.STRING);
@@ -132,27 +135,41 @@ public class CIStatusValidator {
     public ValidationResult isValid(Path artifactFilePath) {
         log.trace("isValid");
 
-        String ciEndpoint = getCIEndpoint(artifactFilePath);
+        String ciEndpoint = getCIStatusEndpoint(artifactFilePath);
         if (ciEndpoint == null) {
             return new ValidationResult(false, "Cannot extract a CI endpoint 
from " + artifactFilePath.getFileName());
         }
         try {
-            JsonObject status = fetchCIStatus(ciEndpoint);
-            List<String> messageEntries = new ArrayList<>();
+            JsonObject status = fetchJson(ciEndpoint);
+
+            if ("pending".equals(status.get(PN_STATE).getAsString())
+                    && status.get("statuses").getAsJsonArray().size() == 0) {
+                log.debug("No build found for tag");
+                if (status.has("commit_url")) {
+                    ciEndpoint = status.get("commit_url").getAsString();
+                    log.debug("Getting parent from commit url: {}", 
ciEndpoint);
+                    JsonObject commit = fetchJson(ciEndpoint);
+                    if (commit.has(PN_PARENTS) && 
commit.get(PN_PARENTS).getAsJsonArray().size() > 0) {
+                        log.debug("Loading commit status: {}", ciEndpoint);
+                        ciEndpoint = 
commit.get(PN_PARENTS).getAsJsonArray().get(0).getAsJsonObject().get("url")
+                                .getAsString() + "/status";
+                        status = fetchJson(ciEndpoint);
+                    }
+                }
+            }
 
-            JsonArray statuses = status.get("statuses").getAsJsonArray();
-            for (JsonElement it : statuses) {
+            List<String> messageEntries = new ArrayList<>();
+            status.get("statuses").getAsJsonArray().forEach(it -> {
                 JsonObject item = it.getAsJsonObject();
                 messageEntries.add("\t" + item.get("context").getAsString());
-                messageEntries.add("\t\tState: " + 
item.get("state").getAsString());
+                messageEntries.add("\t\tState: " + 
item.get(PN_STATE).getAsString());
                 messageEntries.add("\t\tDescription: " + 
item.get("description").getAsString());
                 messageEntries.add("\t\tSee: " + 
item.get("target_url").getAsString());
-            }
+            });
             String message = String.join("\n", messageEntries);
-            if ("success".equals(status.get("state").getAsString())) {
+            if ("success".equals(status.get(PN_STATE).getAsString())) {
                 return new ValidationResult(true, message);
             } else {
-
                 return new ValidationResult(false, message);
             }
         } catch (UnsupportedOperationException | IOException e) {
@@ -162,6 +179,6 @@ public class CIStatusValidator {
 
     public boolean shouldCheck(Artifact artifact, Path artifactFilePath) {
         log.trace("shouldCheck");
-        return "pom".equals(artifact.getType()) && 
getCIEndpoint(artifactFilePath) != null;
+        return "pom".equals(artifact.getType()) && 
getCIStatusEndpoint(artifactFilePath) != null;
     }
 }
diff --git 
a/src/test/java/org/apache/sling/cli/impl/ci/CIStatusValidatorTest.java 
b/src/test/java/org/apache/sling/cli/impl/ci/CIStatusValidatorTest.java
index 183c0dd..9aa127f 100644
--- a/src/test/java/org/apache/sling/cli/impl/ci/CIStatusValidatorTest.java
+++ b/src/test/java/org/apache/sling/cli/impl/ci/CIStatusValidatorTest.java
@@ -16,86 +16,132 @@
  */
 package org.apache.sling.cli.impl.ci;
 
-import java.io.InputStreamReader;
-import java.net.URI;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
 import java.net.URISyntaxException;
 import java.nio.file.Path;
+import java.util.HashMap;
+import java.util.Map;
 
+import org.apache.http.HttpEntity;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.sling.cli.impl.CredentialsService;
 import org.apache.sling.cli.impl.ci.CIStatusValidator.ValidationResult;
+import org.apache.sling.cli.impl.http.HttpClientFactory;
+import org.apache.sling.cli.impl.junit.SystemPropertiesRule;
 import org.apache.sling.cli.impl.nexus.Artifact;
 import org.apache.sling.cli.impl.nexus.StagingRepository;
+import org.apache.sling.testing.mock.osgi.junit.OsgiContext;
+import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-
 public class CIStatusValidatorTest {
 
-    private CIStatusValidator validator = new CIStatusValidator() {
-
-        protected JsonObject fetchCIStatus(String ciEndpoint) throws 
UnsupportedOperationException {
-            InputStreamReader reader = null;
-            if 
("https://api.github.com/repos/apache/sling-repo-pom/commits/repo-pom-1.0/status".equals(ciEndpoint))
 {
-                reader = new 
InputStreamReader(CIStatusValidatorTest.class.getResourceAsStream("/ci/failure.json"));
-            } else if 
("https://api.github.com/repos/apache/sling-repo-pom/commits/repo-pom-1.1/status";
-                    .equals(ciEndpoint)) {
-                reader = new 
InputStreamReader(CIStatusValidatorTest.class.getResourceAsStream("/ci/success.json"));
-            }
-            if (reader == null) {
-                throw new NullPointerException("No reader was found for " + 
ciEndpoint);
-            }
-            JsonParser parser = new JsonParser();
-            return parser.parse(reader).getAsJsonObject();
-        }
-
-    };
     private static final StagingRepository REPOSITORY = 
mock(StagingRepository.class);
     private static Artifact JAR = new Artifact(REPOSITORY, "org.apache.sling", 
"sample-artifact", "1.0", "", "jar");
-    private static Artifact NON_REPO_POM_ARTIFACT = new Artifact(REPOSITORY, 
"org.apache.sling", "no-repo-pom", "1.0", "", "pom");
-    private static Path NON_REPO_POM_FILE;
+    private static Artifact NON_REPO_POM_ARTIFACT = new Artifact(REPOSITORY, 
"org.apache.sling", "no-repo-pom", "1.0",
+            "", "pom");
     private static Artifact POM_ARTIFACT = new Artifact(REPOSITORY, 
"org.apache.sling", "repo-pom", "1.0", "", "pom");
-    private static Path POM_FILE;
-    private static Path SUCCESSFUL_POM_FILE;
+    private static final Map<String, String> SYSTEM_PROPS = new HashMap<>();
+
+    @Rule
+    public final SystemPropertiesRule sysProps = new 
SystemPropertiesRule(SYSTEM_PROPS);
 
     static {
-        try {
-            URI nonrepo = 
CIStatusValidatorTest.class.getResource("/ci/no-repo.pom").toURI();
-            NON_REPO_POM_FILE = Path.of(nonrepo);
-            URI repo = 
CIStatusValidatorTest.class.getResource("/ci/repo-1.0.pom").toURI();
-            URI successfulRepo = 
CIStatusValidatorTest.class.getResource("/ci/repo-1.1.pom").toURI();
-            POM_FILE = Path.of(repo);
-            SUCCESSFUL_POM_FILE = Path.of(successfulRepo);
-        } catch (URISyntaxException e) {
-            throw new RuntimeException(e);
-        }
+        SYSTEM_PROPS.put("asf.username", "asf-user");
+        SYSTEM_PROPS.put("asf.password", "asf-password");
+        SYSTEM_PROPS.put("jira.username", "jira-user");
+        SYSTEM_PROPS.put("jira.password", "jira-password");
+    }
+
+    @Rule
+    public OsgiContext context = new OsgiContext();
+
+    private HttpClientFactory clientFactory;
+    private CIStatusValidator validator;
+    private Map<String, String> urlResourceMap = new HashMap<>();
+
+    @Before
+    public void before() throws ClientProtocolException, IOException {
+        clientFactory = mock(HttpClientFactory.class);
+        CloseableHttpClient httpClient = mock(CloseableHttpClient.class);
+
+        when(httpClient.execute(any(HttpGet.class))).thenAnswer(inv -> {
+            HttpGet get = inv.getArgument(0, HttpGet.class);
+            CloseableHttpResponse response = mock(CloseableHttpResponse.class);
+            if (urlResourceMap.containsKey(get.getURI().toString())) {
+                HttpEntity entity = mock(HttpEntity.class);
+                when(entity.getContent()).thenReturn(
+                        
CIStatusValidatorTest.class.getResourceAsStream(urlResourceMap.get(get.getURI().toString())));
+                when(response.getEntity()).thenReturn(entity);
+            } else {
+                throw new IOException("Failed to call URL: " + get.getURI());
+            }
+            return response;
+        });
+        when(clientFactory.newClient()).thenReturn(httpClient);
+
+        
urlResourceMap.put("https://api.github.com/repos/apache/sling-repo-pom/commits/repo-pom-1.0/status";,
+                "/ci/failure.json");
+        
urlResourceMap.put("https://api.github.com/repos/apache/sling-repo-pom/commits/repo-pom-1.1/status";,
+                "/ci/success.json");
+        
urlResourceMap.put("https://api.github.com/repos/apache/sling-parent/commits/sling-parent-reactor-47/status";,
+                "/ci/tag-status.json");
+        urlResourceMap.put(
+                
"https://api.github.com/repos/apache/sling-parent/commits/4d051750e93d473d9918c8498233cd42f0f991e6";,
+                "/ci/tag-commit.json");
+        urlResourceMap.put(
+                
"https://api.github.com/repos/apache/sling-parent/commits/aa817336d9929371240adac084ec439ad6d185da/status";,
+                "/ci/parent-status.json");
+
+        context.registerInjectActivateService(new CredentialsService());
+        context.registerInjectActivateService(clientFactory);
+        validator = context.registerInjectActivateService(new 
CIStatusValidator());
+    }
+
+    private Path getResourcePath(String resourceName) throws 
URISyntaxException {
+        return 
Path.of(CIStatusValidatorTest.class.getResource(resourceName).toURI());
     }
 
     @Test
-    public void shouldCheck() {
+    public void shouldCheck() throws URISyntaxException {
         assertFalse(validator.shouldCheck(JAR, null));
-        assertFalse(validator.shouldCheck(NON_REPO_POM_ARTIFACT, 
NON_REPO_POM_FILE));
-        assertTrue(validator.shouldCheck(POM_ARTIFACT, POM_FILE));
+        assertFalse(validator.shouldCheck(NON_REPO_POM_ARTIFACT, 
getResourcePath("/ci/no-repo.pom")));
+        assertTrue(validator.shouldCheck(POM_ARTIFACT, 
getResourcePath("/ci/repo-1.0.pom")));
+    }
+
+    @Test
+    public void shouldGetParentCommitForTag() throws URISyntaxException {
+        ValidationResult valid = validator
+                .isValid(getResourcePath("/ci/tag-test.pom"));
+        assertTrue(valid.isValid());
+        assertNotNull(valid.getMessage());
     }
 
     @Test
-    public void getCIEndpoint() {
+    public void getCIStatusEndpoint() throws URISyntaxException {
         
assertEquals("https://api.github.com/repos/apache/sling-repo-pom/commits/repo-pom-1.0/status";,
-                validator.getCIEndpoint(POM_FILE));
+                
validator.getCIStatusEndpoint(getResourcePath("/ci/repo-1.0.pom")));
     }
 
     @Test
-    public void isValid() {
-        ValidationResult invalid = validator.isValid(POM_FILE);
+    public void isValid() throws URISyntaxException {
+        ValidationResult invalid = 
validator.isValid(getResourcePath("/ci/repo-1.0.pom"));
         assertFalse(invalid.isValid());
         assertNotNull(invalid.getMessage());
 
-        ValidationResult valid = validator.isValid(SUCCESSFUL_POM_FILE);
+        ValidationResult valid = 
validator.isValid(getResourcePath("/ci/repo-1.1.pom"));
         assertTrue(valid.isValid());
         assertNotNull(valid.getMessage());
     }
diff --git a/src/test/resources/ci/parent-status.json 
b/src/test/resources/ci/parent-status.json
new file mode 100644
index 0000000..e802a8c
--- /dev/null
+++ b/src/test/resources/ci/parent-status.json
@@ -0,0 +1,149 @@
+{
+    "state": "success",
+    "statuses": [
+      {
+        "url": 
"https://api.github.com/repos/apache/sling-parent/statuses/aa817336d9929371240adac084ec439ad6d185da";,
+        "avatar_url": "https://avatars.githubusercontent.com/u/21237?v=4";,
+        "id": 15920311788,
+        "node_id": "SC_kwDOBmdW588AAAADtOyt7A",
+        "state": "success",
+        "description": "This commit looks good",
+        "target_url": 
"https://ci-builds.apache.org/job/Sling/job/modules/job/sling-parent/job/master/146/display/redirect";,
+        "context": "continuous-integration/jenkins/branch",
+        "created_at": "2022-01-18T18:27:45Z",
+        "updated_at": "2022-01-18T18:27:45Z"
+      },
+      {
+        "url": 
"https://api.github.com/repos/apache/sling-parent/statuses/aa817336d9929371240adac084ec439ad6d185da";,
+        "avatar_url": "https://avatars.githubusercontent.com/u/21237?v=4";,
+        "id": 15920387801,
+        "node_id": "SC_kwDOBmdW588AAAADtO3W2Q",
+        "state": "success",
+        "description": "Finished",
+        "target_url": 
"https://ci-builds.apache.org/job/Sling/job/modules/job/sling-parent/job/master/146/display/redirect?cloudbees-analytics-link=scm-reporting%2Fstage%2Fneutral";,
+        "context": "ci/cloudbees/stage/Init",
+        "created_at": "2022-01-18T18:32:58Z",
+        "updated_at": "2022-01-18T18:32:58Z"
+      },
+      {
+        "url": 
"https://api.github.com/repos/apache/sling-parent/statuses/aa817336d9929371240adac084ec439ad6d185da";,
+        "avatar_url": "https://avatars.githubusercontent.com/u/21237?v=4";,
+        "id": 15920387890,
+        "node_id": "SC_kwDOBmdW588AAAADtO3XMg",
+        "state": "success",
+        "description": "Finished",
+        "target_url": 
"https://ci-builds.apache.org/job/Sling/job/modules/job/sling-parent/job/master/146/display/redirect?cloudbees-analytics-link=scm-reporting%2Fstage%2Fneutral";,
+        "context": "ci/cloudbees/stage/Configure Job",
+        "created_at": "2022-01-18T18:32:58Z",
+        "updated_at": "2022-01-18T18:32:58Z"
+      },
+      {
+        "url": 
"https://api.github.com/repos/apache/sling-parent/statuses/aa817336d9929371240adac084ec439ad6d185da";,
+        "avatar_url": "https://avatars.githubusercontent.com/u/21237?v=4";,
+        "id": 15920387980,
+        "node_id": "SC_kwDOBmdW588AAAADtO3XjA",
+        "state": "success",
+        "description": "Finished",
+        "target_url": 
"https://ci-builds.apache.org/job/Sling/job/modules/job/sling-parent/job/master/146/display/redirect?cloudbees-analytics-link=scm-reporting%2Fstage%2Fneutral";,
+        "context": "ci/cloudbees/stage/Build (Java 8, deploy)",
+        "created_at": "2022-01-18T18:32:59Z",
+        "updated_at": "2022-01-18T18:32:59Z"
+      },
+      {
+        "url": 
"https://api.github.com/repos/apache/sling-parent/statuses/aa817336d9929371240adac084ec439ad6d185da";,
+        "avatar_url": "https://avatars.githubusercontent.com/u/21237?v=4";,
+        "id": 15920388606,
+        "node_id": "SC_kwDOBmdW588AAAADtO3Z_g",
+        "state": "success",
+        "description": "Finished",
+        "target_url": 
"https://ci-builds.apache.org/job/Sling/job/modules/job/sling-parent/job/master/146/display/redirect?cloudbees-analytics-link=scm-reporting%2Fstage%2Fneutral";,
+        "context": "ci/cloudbees/stage/SonarCloud",
+        "created_at": "2022-01-18T18:33:02Z",
+        "updated_at": "2022-01-18T18:33:02Z"
+      },
+      {
+        "url": 
"https://api.github.com/repos/apache/sling-parent/statuses/aa817336d9929371240adac084ec439ad6d185da";,
+        "avatar_url": "https://avatars.githubusercontent.com/u/21237?v=4";,
+        "id": 15920388691,
+        "node_id": "SC_kwDOBmdW588AAAADtO3aUw",
+        "state": "success",
+        "description": "Finished",
+        "target_url": 
"https://ci-builds.apache.org/job/Sling/job/modules/job/sling-parent/job/master/146/display/redirect?cloudbees-analytics-link=scm-reporting%2Fstage%2Fneutral";,
+        "context": "ci/cloudbees/stage/Notifications",
+        "created_at": "2022-01-18T18:33:02Z",
+        "updated_at": "2022-01-18T18:33:02Z"
+      }
+    ],
+    "sha": "aa817336d9929371240adac084ec439ad6d185da",
+    "total_count": 6,
+    "repository": {
+      "id": 107435751,
+      "node_id": "MDEwOlJlcG9zaXRvcnkxMDc0MzU3NTE=",
+      "name": "sling-parent",
+      "full_name": "apache/sling-parent",
+      "private": false,
+      "owner": {
+        "login": "apache",
+        "id": 47359,
+        "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ3MzU5",
+        "avatar_url": "https://avatars.githubusercontent.com/u/47359?v=4";,
+        "gravatar_id": "",
+        "url": "https://api.github.com/users/apache";,
+        "html_url": "https://github.com/apache";,
+        "followers_url": "https://api.github.com/users/apache/followers";,
+        "following_url": 
"https://api.github.com/users/apache/following{/other_user}";,
+        "gists_url": "https://api.github.com/users/apache/gists{/gist_id}";,
+        "starred_url": 
"https://api.github.com/users/apache/starred{/owner}{/repo}";,
+        "subscriptions_url": 
"https://api.github.com/users/apache/subscriptions";,
+        "organizations_url": "https://api.github.com/users/apache/orgs";,
+        "repos_url": "https://api.github.com/users/apache/repos";,
+        "events_url": "https://api.github.com/users/apache/events{/privacy}";,
+        "received_events_url": 
"https://api.github.com/users/apache/received_events";,
+        "type": "Organization",
+        "site_admin": false
+      },
+      "html_url": "https://github.com/apache/sling-parent";,
+      "description": "Apache Sling Parent",
+      "fork": false,
+      "url": "https://api.github.com/repos/apache/sling-parent";,
+      "forks_url": "https://api.github.com/repos/apache/sling-parent/forks";,
+      "keys_url": 
"https://api.github.com/repos/apache/sling-parent/keys{/key_id}";,
+      "collaborators_url": 
"https://api.github.com/repos/apache/sling-parent/collaborators{/collaborator}";,
+      "teams_url": "https://api.github.com/repos/apache/sling-parent/teams";,
+      "hooks_url": "https://api.github.com/repos/apache/sling-parent/hooks";,
+      "issue_events_url": 
"https://api.github.com/repos/apache/sling-parent/issues/events{/number}";,
+      "events_url": "https://api.github.com/repos/apache/sling-parent/events";,
+      "assignees_url": 
"https://api.github.com/repos/apache/sling-parent/assignees{/user}";,
+      "branches_url": 
"https://api.github.com/repos/apache/sling-parent/branches{/branch}";,
+      "tags_url": "https://api.github.com/repos/apache/sling-parent/tags";,
+      "blobs_url": 
"https://api.github.com/repos/apache/sling-parent/git/blobs{/sha}";,
+      "git_tags_url": 
"https://api.github.com/repos/apache/sling-parent/git/tags{/sha}";,
+      "git_refs_url": 
"https://api.github.com/repos/apache/sling-parent/git/refs{/sha}";,
+      "trees_url": 
"https://api.github.com/repos/apache/sling-parent/git/trees{/sha}";,
+      "statuses_url": 
"https://api.github.com/repos/apache/sling-parent/statuses/{sha}";,
+      "languages_url": 
"https://api.github.com/repos/apache/sling-parent/languages";,
+      "stargazers_url": 
"https://api.github.com/repos/apache/sling-parent/stargazers";,
+      "contributors_url": 
"https://api.github.com/repos/apache/sling-parent/contributors";,
+      "subscribers_url": 
"https://api.github.com/repos/apache/sling-parent/subscribers";,
+      "subscription_url": 
"https://api.github.com/repos/apache/sling-parent/subscription";,
+      "commits_url": 
"https://api.github.com/repos/apache/sling-parent/commits{/sha}";,
+      "git_commits_url": 
"https://api.github.com/repos/apache/sling-parent/git/commits{/sha}";,
+      "comments_url": 
"https://api.github.com/repos/apache/sling-parent/comments{/number}";,
+      "issue_comment_url": 
"https://api.github.com/repos/apache/sling-parent/issues/comments{/number}";,
+      "contents_url": 
"https://api.github.com/repos/apache/sling-parent/contents/{+path}";,
+      "compare_url": 
"https://api.github.com/repos/apache/sling-parent/compare/{base}...{head}";,
+      "merges_url": "https://api.github.com/repos/apache/sling-parent/merges";,
+      "archive_url": 
"https://api.github.com/repos/apache/sling-parent/{archive_format}{/ref}";,
+      "downloads_url": 
"https://api.github.com/repos/apache/sling-parent/downloads";,
+      "issues_url": 
"https://api.github.com/repos/apache/sling-parent/issues{/number}";,
+      "pulls_url": 
"https://api.github.com/repos/apache/sling-parent/pulls{/number}";,
+      "milestones_url": 
"https://api.github.com/repos/apache/sling-parent/milestones{/number}";,
+      "notifications_url": 
"https://api.github.com/repos/apache/sling-parent/notifications{?since,all,participating}";,
+      "labels_url": 
"https://api.github.com/repos/apache/sling-parent/labels{/name}";,
+      "releases_url": 
"https://api.github.com/repos/apache/sling-parent/releases{/id}";,
+      "deployments_url": 
"https://api.github.com/repos/apache/sling-parent/deployments";
+    },
+    "commit_url": 
"https://api.github.com/repos/apache/sling-parent/commits/aa817336d9929371240adac084ec439ad6d185da";,
+    "url": 
"https://api.github.com/repos/apache/sling-parent/commits/aa817336d9929371240adac084ec439ad6d185da/status";
+  }
+  
\ No newline at end of file
diff --git a/src/test/resources/ci/tag-commit.json 
b/src/test/resources/ci/tag-commit.json
new file mode 100644
index 0000000..7fb1e64
--- /dev/null
+++ b/src/test/resources/ci/tag-commit.json
@@ -0,0 +1,123 @@
+{
+    "sha": "4d051750e93d473d9918c8498233cd42f0f991e6",
+    "node_id": 
"C_kwDOBmdW59oAKDRkMDUxNzUwZTkzZDQ3M2Q5OTE4Yzg0OTgyMzNjZDQyZjBmOTkxZTY",
+    "commit": {
+      "author": {
+        "name": "Konrad Windszus",
+        "email": "[email protected]",
+        "date": "2022-01-18T18:26:54Z"
+      },
+      "committer": {
+        "name": "Konrad Windszus",
+        "email": "[email protected]",
+        "date": "2022-01-18T18:26:54Z"
+      },
+      "message": "[maven-release-plugin] prepare release 
sling-parent-reactor-47",
+      "tree": {
+        "sha": "ddf912d902094067f593d5b006921f0898ee6d70",
+        "url": 
"https://api.github.com/repos/apache/sling-parent/git/trees/ddf912d902094067f593d5b006921f0898ee6d70";
+      },
+      "url": 
"https://api.github.com/repos/apache/sling-parent/git/commits/4d051750e93d473d9918c8498233cd42f0f991e6";,
+      "comment_count": 0,
+      "verification": {
+        "verified": false,
+        "reason": "unsigned",
+        "signature": null,
+        "payload": null
+      }
+    },
+    "url": 
"https://api.github.com/repos/apache/sling-parent/commits/4d051750e93d473d9918c8498233cd42f0f991e6";,
+    "html_url": 
"https://github.com/apache/sling-parent/commit/4d051750e93d473d9918c8498233cd42f0f991e6";,
+    "comments_url": 
"https://api.github.com/repos/apache/sling-parent/commits/4d051750e93d473d9918c8498233cd42f0f991e6/comments";,
+    "author": {
+      "login": "kwin",
+      "id": 185025,
+      "node_id": "MDQ6VXNlcjE4NTAyNQ==",
+      "avatar_url": "https://avatars.githubusercontent.com/u/185025?v=4";,
+      "gravatar_id": "",
+      "url": "https://api.github.com/users/kwin";,
+      "html_url": "https://github.com/kwin";,
+      "followers_url": "https://api.github.com/users/kwin/followers";,
+      "following_url": 
"https://api.github.com/users/kwin/following{/other_user}";,
+      "gists_url": "https://api.github.com/users/kwin/gists{/gist_id}";,
+      "starred_url": 
"https://api.github.com/users/kwin/starred{/owner}{/repo}";,
+      "subscriptions_url": "https://api.github.com/users/kwin/subscriptions";,
+      "organizations_url": "https://api.github.com/users/kwin/orgs";,
+      "repos_url": "https://api.github.com/users/kwin/repos";,
+      "events_url": "https://api.github.com/users/kwin/events{/privacy}";,
+      "received_events_url": 
"https://api.github.com/users/kwin/received_events";,
+      "type": "User",
+      "site_admin": false
+    },
+    "committer": {
+      "login": "kwin",
+      "id": 185025,
+      "node_id": "MDQ6VXNlcjE4NTAyNQ==",
+      "avatar_url": "https://avatars.githubusercontent.com/u/185025?v=4";,
+      "gravatar_id": "",
+      "url": "https://api.github.com/users/kwin";,
+      "html_url": "https://github.com/kwin";,
+      "followers_url": "https://api.github.com/users/kwin/followers";,
+      "following_url": 
"https://api.github.com/users/kwin/following{/other_user}";,
+      "gists_url": "https://api.github.com/users/kwin/gists{/gist_id}";,
+      "starred_url": 
"https://api.github.com/users/kwin/starred{/owner}{/repo}";,
+      "subscriptions_url": "https://api.github.com/users/kwin/subscriptions";,
+      "organizations_url": "https://api.github.com/users/kwin/orgs";,
+      "repos_url": "https://api.github.com/users/kwin/repos";,
+      "events_url": "https://api.github.com/users/kwin/events{/privacy}";,
+      "received_events_url": 
"https://api.github.com/users/kwin/received_events";,
+      "type": "User",
+      "site_admin": false
+    },
+    "parents": [
+      {
+        "sha": "aa817336d9929371240adac084ec439ad6d185da",
+        "url": 
"https://api.github.com/repos/apache/sling-parent/commits/aa817336d9929371240adac084ec439ad6d185da";,
+        "html_url": 
"https://github.com/apache/sling-parent/commit/aa817336d9929371240adac084ec439ad6d185da";
+      }
+    ],
+    "stats": {
+      "total": 12,
+      "additions": 6,
+      "deletions": 6
+    },
+    "files": [
+      {
+        "sha": "5ebb45f95ba197d59ab33bd764b967d9b1d7262c",
+        "filename": "pom.xml",
+        "status": "modified",
+        "additions": 2,
+        "deletions": 2,
+        "changes": 4,
+        "blob_url": 
"https://github.com/apache/sling-parent/blob/4d051750e93d473d9918c8498233cd42f0f991e6/pom.xml";,
+        "raw_url": 
"https://github.com/apache/sling-parent/raw/4d051750e93d473d9918c8498233cd42f0f991e6/pom.xml";,
+        "contents_url": 
"https://api.github.com/repos/apache/sling-parent/contents/pom.xml?ref=4d051750e93d473d9918c8498233cd42f0f991e6";,
+        "patch": "@@ -21,7 +21,7 @@\n     
<groupId>org.apache.sling</groupId>\n     
<artifactId>sling-parent-reactor</artifactId>\n     
<packaging>pom</packaging>\n-    <version>47-SNAPSHOT</version>\n+    
<version>47</version>\n \n     <!-- the ASF parent is necessary to trigger the 
right release profile -->\n     <parent>\n@@ -38,7 +38,7 @@\n         
<connection>scm:git:https://gitbox.apache.org/repos/asf/sling-parent.git</connection>\n
         <developerConnection>scm:git:https://gitb [...]
+      },
+      {
+        "sha": "2ce4839d0d0f70c7b90e8f28b27894c0470da8b4",
+        "filename": "sling-bundle-parent/pom.xml",
+        "status": "modified",
+        "additions": 2,
+        "deletions": 2,
+        "changes": 4,
+        "blob_url": 
"https://github.com/apache/sling-parent/blob/4d051750e93d473d9918c8498233cd42f0f991e6/sling-bundle-parent/pom.xml";,
+        "raw_url": 
"https://github.com/apache/sling-parent/raw/4d051750e93d473d9918c8498233cd42f0f991e6/sling-bundle-parent/pom.xml";,
+        "contents_url": 
"https://api.github.com/repos/apache/sling-parent/contents/sling-bundle-parent/pom.xml?ref=4d051750e93d473d9918c8498233cd42f0f991e6";,
+        "patch": "@@ -21,7 +21,7 @@\n     <parent>\n         
<groupId>org.apache.sling</groupId>\n         <artifactId>sling</artifactId>\n- 
       <version>47-SNAPSHOT</version>\n+        <version>47</version>\n         
<relativePath>../sling-parent</relativePath>\n     </parent>\n \n@@ -36,7 +36,7 
@@\n         
<connection>scm:git:https://gitbox.apache.org/repos/asf/sling-parent.git</connection>\n
         
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-parent.git<
 [...]
+      },
+      {
+        "sha": "d94f94c75b8388abea9660f0c427fddb16112f57",
+        "filename": "sling-parent/pom.xml",
+        "status": "modified",
+        "additions": 2,
+        "deletions": 2,
+        "changes": 4,
+        "blob_url": 
"https://github.com/apache/sling-parent/blob/4d051750e93d473d9918c8498233cd42f0f991e6/sling-parent/pom.xml";,
+        "raw_url": 
"https://github.com/apache/sling-parent/raw/4d051750e93d473d9918c8498233cd42f0f991e6/sling-parent/pom.xml";,
+        "contents_url": 
"https://api.github.com/repos/apache/sling-parent/contents/sling-parent/pom.xml?ref=4d051750e93d473d9918c8498233cd42f0f991e6";,
+        "patch": "@@ -28,7 +28,7 @@\n     
<groupId>org.apache.sling</groupId>\n     <artifactId>sling</artifactId>\n     
<packaging>pom</packaging>\n-    <version>47-SNAPSHOT</version>\n+    
<version>47</version>\n \n     <name>Apache Sling (Parent)</name>\n     
<description>The parent project for Apache Sling</description>\n@@ -72,7 +72,7 
@@\n         
<connection>scm:git:https://gitbox.apache.org/repos/asf/sling-parent.git</connection>\n
         <developerConnection>scm:git:https://gitb [...]
+      }
+    ]
+  }
+  
\ No newline at end of file
diff --git a/src/test/resources/ci/tag-status.json 
b/src/test/resources/ci/tag-status.json
new file mode 100644
index 0000000..9f48cb8
--- /dev/null
+++ b/src/test/resources/ci/tag-status.json
@@ -0,0 +1,75 @@
+{
+  "state": "pending",
+  "statuses": [],
+  "sha": "4d051750e93d473d9918c8498233cd42f0f991e6",
+  "total_count": 0,
+  "repository": {
+    "id": 107435751,
+    "node_id": "MDEwOlJlcG9zaXRvcnkxMDc0MzU3NTE=",
+    "name": "sling-parent",
+    "full_name": "apache/sling-parent",
+    "private": false,
+    "owner": {
+      "login": "apache",
+      "id": 47359,
+      "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ3MzU5",
+      "avatar_url": "https://avatars.githubusercontent.com/u/47359?v=4";,
+      "gravatar_id": "",
+      "url": "https://api.github.com/users/apache";,
+      "html_url": "https://github.com/apache";,
+      "followers_url": "https://api.github.com/users/apache/followers";,
+      "following_url": 
"https://api.github.com/users/apache/following{/other_user}";,
+      "gists_url": "https://api.github.com/users/apache/gists{/gist_id}";,
+      "starred_url": 
"https://api.github.com/users/apache/starred{/owner}{/repo}";,
+      "subscriptions_url": "https://api.github.com/users/apache/subscriptions";,
+      "organizations_url": "https://api.github.com/users/apache/orgs";,
+      "repos_url": "https://api.github.com/users/apache/repos";,
+      "events_url": "https://api.github.com/users/apache/events{/privacy}";,
+      "received_events_url": 
"https://api.github.com/users/apache/received_events";,
+      "type": "Organization",
+      "site_admin": false
+    },
+    "html_url": "https://github.com/apache/sling-parent";,
+    "description": "Apache Sling Parent",
+    "fork": false,
+    "url": "https://api.github.com/repos/apache/sling-parent";,
+    "forks_url": "https://api.github.com/repos/apache/sling-parent/forks";,
+    "keys_url": 
"https://api.github.com/repos/apache/sling-parent/keys{/key_id}";,
+    "collaborators_url": 
"https://api.github.com/repos/apache/sling-parent/collaborators{/collaborator}";,
+    "teams_url": "https://api.github.com/repos/apache/sling-parent/teams";,
+    "hooks_url": "https://api.github.com/repos/apache/sling-parent/hooks";,
+    "issue_events_url": 
"https://api.github.com/repos/apache/sling-parent/issues/events{/number}";,
+    "events_url": "https://api.github.com/repos/apache/sling-parent/events";,
+    "assignees_url": 
"https://api.github.com/repos/apache/sling-parent/assignees{/user}";,
+    "branches_url": 
"https://api.github.com/repos/apache/sling-parent/branches{/branch}";,
+    "tags_url": "https://api.github.com/repos/apache/sling-parent/tags";,
+    "blobs_url": 
"https://api.github.com/repos/apache/sling-parent/git/blobs{/sha}";,
+    "git_tags_url": 
"https://api.github.com/repos/apache/sling-parent/git/tags{/sha}";,
+    "git_refs_url": 
"https://api.github.com/repos/apache/sling-parent/git/refs{/sha}";,
+    "trees_url": 
"https://api.github.com/repos/apache/sling-parent/git/trees{/sha}";,
+    "statuses_url": 
"https://api.github.com/repos/apache/sling-parent/statuses/{sha}";,
+    "languages_url": 
"https://api.github.com/repos/apache/sling-parent/languages";,
+    "stargazers_url": 
"https://api.github.com/repos/apache/sling-parent/stargazers";,
+    "contributors_url": 
"https://api.github.com/repos/apache/sling-parent/contributors";,
+    "subscribers_url": 
"https://api.github.com/repos/apache/sling-parent/subscribers";,
+    "subscription_url": 
"https://api.github.com/repos/apache/sling-parent/subscription";,
+    "commits_url": 
"https://api.github.com/repos/apache/sling-parent/commits{/sha}";,
+    "git_commits_url": 
"https://api.github.com/repos/apache/sling-parent/git/commits{/sha}";,
+    "comments_url": 
"https://api.github.com/repos/apache/sling-parent/comments{/number}";,
+    "issue_comment_url": 
"https://api.github.com/repos/apache/sling-parent/issues/comments{/number}";,
+    "contents_url": 
"https://api.github.com/repos/apache/sling-parent/contents/{+path}";,
+    "compare_url": 
"https://api.github.com/repos/apache/sling-parent/compare/{base}...{head}";,
+    "merges_url": "https://api.github.com/repos/apache/sling-parent/merges";,
+    "archive_url": 
"https://api.github.com/repos/apache/sling-parent/{archive_format}{/ref}";,
+    "downloads_url": 
"https://api.github.com/repos/apache/sling-parent/downloads";,
+    "issues_url": 
"https://api.github.com/repos/apache/sling-parent/issues{/number}";,
+    "pulls_url": 
"https://api.github.com/repos/apache/sling-parent/pulls{/number}";,
+    "milestones_url": 
"https://api.github.com/repos/apache/sling-parent/milestones{/number}";,
+    "notifications_url": 
"https://api.github.com/repos/apache/sling-parent/notifications{?since,all,participating}";,
+    "labels_url": 
"https://api.github.com/repos/apache/sling-parent/labels{/name}";,
+    "releases_url": 
"https://api.github.com/repos/apache/sling-parent/releases{/id}";,
+    "deployments_url": 
"https://api.github.com/repos/apache/sling-parent/deployments";
+  },
+  "commit_url": 
"https://api.github.com/repos/apache/sling-parent/commits/4d051750e93d473d9918c8498233cd42f0f991e6";,
+  "url": 
"https://api.github.com/repos/apache/sling-parent/commits/4d051750e93d473d9918c8498233cd42f0f991e6/status";
+}
diff --git a/src/test/resources/ci/tag-test.pom 
b/src/test/resources/ci/tag-test.pom
new file mode 100644
index 0000000..5ebb45f
--- /dev/null
+++ b/src/test/resources/ci/tag-test.pom
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or
+    more contributor license agreements. See the NOTICE file
+    distributed with this work for additional information regarding
+    copyright ownership. The ASF licenses this file to you under the
+    Apache License, Version 2.0 (the "License"); you may not use
+    this file except in compliance with the License. You may obtain
+    a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+    applicable law or agreed to in writing, software distributed
+    under the License is distributed on an "AS IS" BASIS, WITHOUT
+    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions
+    and limitations under the License.
+-->
+<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>
+
+    <groupId>org.apache.sling</groupId>
+    <artifactId>sling-parent-reactor</artifactId>
+    <packaging>pom</packaging>
+    <version>47</version>
+
+    <!-- the ASF parent is necessary to trigger the right release profile -->
+    <parent>
+        <groupId>org.apache</groupId>
+        <artifactId>apache</artifactId>
+        <version>24</version>
+        <relativePath />
+    </parent>
+    
+    <name>Apache Sling Parent Reactor</name>
+    <description>The reactor pom to build all Sling parents</description>
+
+    <scm>
+        
<connection>scm:git:https://gitbox.apache.org/repos/asf/sling-parent.git</connection>
+        
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-parent.git</developerConnection>
+        <url>https://gitbox.apache.org/repos/asf?p=sling-parent.git</url>
+        <tag>sling-parent-reactor-47</tag>
+    </scm>
+
+    <modules>
+        <module>sling-parent</module>
+        <module>sling-bundle-parent</module>
+    </modules>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-deploy-plugin</artifactId>
+                <configuration>
+                    <!--  don't deploy reactor module itself -->
+                    <skip>true</skip>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-install-plugin</artifactId>
+                <version>3.0.0-M1</version>
+                <configuration>
+                    <!--  don't deploy reactor module itself -->
+                    <skip>true</skip>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-enforcer-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>enforce-output-timestamp-property</id>
+                        <configuration>
+                            <skip>true</skip>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

Reply via email to