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

Updates SCM URLs in POM files from git:// to https:// protocol. #560

Merged
merged 11 commits into from
Jan 4, 2025
Merged
Prev Previous commit
Modified the UpdateScmUrl recipe to apply only to 'connection'
  • Loading branch information
nagu165 committed Jan 4, 2025
commit f44ca2eb4e74aaad90f0c43e423ef211a353f4c4
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ public Xml.Tag visitTag(Xml.Tag tag, ExecutionContext ctx) {

if (childTag.getValue().isPresent()) {
String value = childTag.getValue().get();
if ("url".equals(childTag.getName()) && value.startsWith("git://")) {
Log.info("Updating SCM URL from 'git://' to 'https://'");
updatedValue = value.replace("git://", "https://");
} else if ("connection".equals(childTag.getName()) && value.startsWith("scm:git:git://")) {
if ("connection".equals(childTag.getName()) && value.startsWith("scm:git:git://")) {
Log.info("Updating SCM connection from 'scm:git:git:' to 'scm:git:https:'");
updatedValue = value.replace("scm:git:git://", "scm:git:https://");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@ void updateScmUrls() {
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.jenkins.plugins</groupId>
<artifactId>empty</artifactId>
<version>1.0.0-SNAPSHOT</version>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.88</version>
<packaging>hpi</packaging>
<name>Empty Plugin</name>
<properties>
<jenkins.version>2.440.3</jenkins.version>
</properties>
<scm>
<url>git://github.com/example/repo.git</url>
<connection>scm:git:git://github.com/example/repo.git</connection>
<connection>scm:git:git://github.com/jenkinsci/your-plugin.git</connection>
</scm>
<repositories>
<repository>
Expand All @@ -44,17 +43,16 @@ void updateScmUrls() {
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.jenkins.plugins</groupId>
<artifactId>empty</artifactId>
<version>1.0.0-SNAPSHOT</version>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.88</version>
<packaging>hpi</packaging>
<name>Empty Plugin</name>
<properties>
<jenkins.version>2.440.3</jenkins.version>
</properties>
<scm>
<url>https://github.com/example/repo.git</url>
<connection>scm:git:https://github.com/example/repo.git</connection>
<connection>scm:git:https://github.com/jenkinsci/your-plugin.git</connection>
</scm>
<repositories>
<repository>
Expand All @@ -76,17 +74,16 @@ void keepExistingHttpsUrls() {
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.jenkins.plugins</groupId>
<artifactId>empty</artifactId>
<version>1.0.0-SNAPSHOT</version>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.88</version>
<packaging>hpi</packaging>
<name>Empty Plugin</name>
<properties>
<jenkins.version>2.440.3</jenkins.version>
</properties>
<scm>
<url>https://github.com/example/repo.git</url>
<connection>scm:git:https://github.com/example/repo.git</connection>
<connection>scm:git:https://github.com/jenkinsci/your-plugin.git</connection>
</scm>
<repositories>
<repository>
Expand Down
Loading