Skip to content

Update README.md 😴𝘅☯️™⚡︎ #13

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

Open
wants to merge 22 commits into
base: develop
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
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public class NGTriggerServiceImpl implements NGTriggerService {
private static final String TRIGGER = "trigger";
private static final String INPUT_YAML = "inputYaml";

private static final String DUP_KEY_EXP_FORMAT_STRING = "Trigger [%s] already exists";
private static final String DUP_KEY_EXP_FORMAT_STRING = "Trigger [%s] already exists or is soft deleted";

@Override
public NGTriggerEntity create(NGTriggerEntity ngTriggerEntity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ public WingsException handleException(Exception exception) {
ExplanationException.INVALID_GIT_API_AUTHORIZATION,
new InvalidRequestException(exception.getMessage(), USER));
} else if (errorCode == ErrorCode.INVALID_REQUEST) {
return NestedExceptionUtils.hintWithExplanationException(HintException.HINT_SCM_INVALID_REQUEST,
ExplanationException.EXPLANATION_SCM_INVALID_REQUEST,
new InvalidRequestException("SCM service running with delegate has error", USER));
return NestedExceptionUtils.hintWithExplanationException("Something went wrong with SCM",
"SCM is not running with delegate agent", new InvalidRequestException(exception.getMessage(), USER));
}
return new InvalidRequestException(exception.getMessage(), USER);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,18 @@ public static String getGitOwner(String url, boolean isAccountLevelConnector) {
}

public static boolean isGithubSAAS(String url) {
return getGitSCM(url).equals("github.com");
String host = getGitSCM(url);
return host.equals("github.com") || host.equals("www.github.com");
}

public static boolean isGitlabSAAS(String url) {
return getGitSCM(url).contains("gitlab.com");
String host = getGitSCM(url);
return host.equals("gitlab.com") || host.equals("www.gitlab.com");
}

public static boolean isBitBucketSAAS(String url) {
return getGitSCM(url).contains("bitbucket.org");
String host = getGitSCM(url);
return host.equals("bitbucket.org") || host.equals("www.bitbucket.org");
}

public static String getGithubApiURL(String url) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static io.harness.rule.OwnerRule.ABOSII;
import static io.harness.rule.OwnerRule.ARVIND;
import static io.harness.rule.OwnerRule.DEEPAK;
import static io.harness.rule.OwnerRule.DEV_MITTAL;
import static io.harness.rule.OwnerRule.HARSH;
import static io.harness.rule.OwnerRule.JAMIE;
import static io.harness.rule.OwnerRule.JELENA;
Expand Down Expand Up @@ -433,4 +434,65 @@ public void testGetChangeType() throws Exception {
assertThat(gitClientHelper.getChangeType(RENAME)).isEqualTo(ChangeType.RENAME);
assertThat(gitClientHelper.getChangeType(COPY)).isEqualTo(null);
}

@Test
@Owner(developers = DEV_MITTAL)
@Category(UnitTests.class)
public void testGetGithubApiURL() {
assertThat(GitClientHelper.getGithubApiURL("https://github.com/devkimittal/harness-core.git"))
.isEqualTo("https://github.com/api/");
assertThat(GitClientHelper.getGithubApiURL("https://www.github.com/devkimittal/harness-core.git"))
.isEqualTo("https://github.com/api/");
assertThat(GitClientHelper.getGithubApiURL("https://www.github.com/devkimittal/harness-core"))
.isEqualTo("https://github.com/api/");
assertThat(GitClientHelper.getGithubApiURL("https://paypal.github.com/devkimittal/harness-core.git"))
.isEqualTo("https://paypal.github.com/api/v3/");
assertThat(GitClientHelper.getGithubApiURL("https://github.paypal.com/devkimittal/harness-core.git"))
.isEqualTo("https://github.paypal.com/api/v3/");
assertThat(GitClientHelper.getGithubApiURL("[email protected]:harness/harness-core.git"))
.isEqualTo("https://github.com/api/");
assertThat(GitClientHelper.getGithubApiURL("[email protected]:harness/harness-core.git"))
.isEqualTo("https://github.com/api/");
}

@Test
@Owner(developers = DEV_MITTAL)
@Category(UnitTests.class)
public void testGetGitlabApiURL() {
assertThat(GitClientHelper.getGitlabApiURL("https://gitlab.com/devki.mittal/test.git"))
.isEqualTo("https://gitlab.com/");
assertThat(GitClientHelper.getGitlabApiURL("https://www.gitlab.com/devki.mittal/test.git"))
.isEqualTo("https://gitlab.com/");
assertThat(GitClientHelper.getGitlabApiURL("https://gitlab.com/devki.mittal/test"))
.isEqualTo("https://gitlab.com/");
assertThat(GitClientHelper.getGitlabApiURL("https://paypal.gitlab.com/devki.mittal/test.git"))
.isEqualTo("https://paypal.gitlab.com/");
assertThat(GitClientHelper.getGitlabApiURL("https://gitlab.paypal.com/devki.mittal/test.git"))
.isEqualTo("https://gitlab.paypal.com/");
assertThat(GitClientHelper.getGitlabApiURL("[email protected]:devki.mittal/test.git"))
.isEqualTo("https://gitlab.com/");
assertThat(GitClientHelper.getGitlabApiURL("[email protected]:devki.mittal/test.git"))
.isEqualTo("https://gitlab.com/");
}

@Test
@Owner(developers = DEV_MITTAL)
@Category(UnitTests.class)
public void testGetBitBucketApiURL() {
assertThat(GitClientHelper.getBitBucketApiURL("https://[email protected]/devmittalciv16/ci_3446.git"))
.isEqualTo("https://api.bitbucket.org/");
assertThat(
GitClientHelper.getBitBucketApiURL("https://[email protected]/devmittalciv16/ci_3446.git"))
.isEqualTo("https://api.bitbucket.org/");
assertThat(GitClientHelper.getBitBucketApiURL("https://[email protected]/devmittalciv16/ci_3446"))
.isEqualTo("https://api.bitbucket.org/");
assertThat(GitClientHelper.getBitBucketApiURL("https://[email protected]/devmittalciv16/ci_3446"))
.isEqualTo("https://bitbucket.paypal.org/");
assertThat(GitClientHelper.getBitBucketApiURL("https://[email protected]/devmittalciv16/ci_3446"))
.isEqualTo("https://paypal.bitbucket.org/");
assertThat(GitClientHelper.getBitBucketApiURL("[email protected]:devmittalciv16/ci_3446.git"))
.isEqualTo("https://api.bitbucket.org/");
assertThat(GitClientHelper.getBitBucketApiURL("[email protected]:devmittalciv16/ci_3446.git"))
.isEqualTo("https://api.bitbucket.org/");
}
}
21 changes: 8 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
This repo contains code used in the [Harness CD Community Edition](https://github.com/harness/harness-cd-community) which is licensed under the [PolyForm Shield License 1.0.0](./licenses/PolyForm-Shield-1.0.0.txt). This repo also contains code belonging to Harness CD Enterprise Plan which is licensed under the [PolyForm Free Trial License 1.0.0](./licenses/PolyForm-Free-Trial-1.0.0.txt). You may obtain a copy of these licenses in the [licenses](./licenses/) directory at the root of this repository.

harness-core Project Dev environment setup instructions
==================================================
## On MacOS

This repo contains code used in the [Harness CD Community Edition](https://github.com/harness/harness-cd-community) which is licensed under the [PolyForm Shield License 1.0.0](./licenses/PolyForm-Shield-1.0.0.txt). This repo also contains code belonging to Harness CD Enterprise Plan which is licensed under the [PolyForm Free Trial License 1.0.0](./licenses/PolyForm-Free-Trial-1.0.0.txt). You may obtain a copy of these licenses in the [licenses](./licenses/) directory at the root o
### Prerequisities
1. Install Homebrew:
```
```vfvf
/bin/bash -c "$(curl -fsSL https://github.com/raw/Homebrew/install/HEAD/install.sh)"
```


2. Download and Install Java 8

*Note: Brew will download and install the latest version of OpenJDK/JRE, its recommended to install OpenJDK/JRE_1.8.0_242 to be in sync with the version everyone is using in the team.*
*Note: Brew will downlosddffvad and install the latest version of OpenJDK/JRE, its recommended to install OpenJDK/JRE_1.8.0_242 to be in sync with the version everyone is using in the team.*

To setup the recommended version, download the OpenJDK 1.8-242 (jdk8u242-b08) JRE .pkg from [AdoptOpenJDK](https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/tag/jdk8u242-b08) and install it. Make sure to update `JAVA_HOME` and `PATH` accordingly (see step 5).

3. Install bazel:
3. Install bazel:fvvdfv
```
brew install bazelisk

Expand All @@ -27,7 +22,7 @@ brew install bazelisk
```
brew install npm
```

dfsv
5. Set up JAVA_HOME: create or add this to your bash profile `~/.bashrc` or `~/.zshrc` file and add following line:
```
export JAVA_HOME=$(/usr/libexec/java_home -v1.8)
Expand All @@ -49,7 +44,7 @@ export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/H
Complete this step only if you are actively working with the protocol buffer files.
```
brew tap bufbuild/buf
brew install buf
brew install bufsdcds
```

To check if your protobuf files are according to the coding standards execute in the root of the repo
Expand Down Expand Up @@ -90,7 +85,7 @@ Official steps to install docker on mac: [docker.com](https://docs.docker.com/de
NOTE: if you clone the repo to another location you will have to do this again. On the other side you will be getting fixes and updates with no extra effort.

### Build

f jgfg g
#### Some Bazel Best Practices you can follow before building harness-core locally.
`https://harness.atlassian.net/wiki/spaces/BT/pages/1910047082/Bazel+best+practices+for+faster+and+efficient+builds.`

Expand Down Expand Up @@ -252,7 +247,7 @@ echo "export PATH="$PATH:$HOME/<path-to-above-directory>/bin" >> ~/.zshrc
to format .graphql files: you can follow these steps:

* `npm install --global [email protected]`

csdvdf
* `prettier --write --print-width=120 <filename>` - formats given graphql file

helper shell scripts:
Expand Down