Skip to content

Commit

Permalink
merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
qingliang.ql committed Jan 9, 2019
2 parents 9debca5 + fa57fa0 commit fb5bbf3
Show file tree
Hide file tree
Showing 84 changed files with 1,291 additions and 982 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
target
.project
.idea
.vscode
.DS_Store
.factorypath
/logs
*.iml
node_modules
Expand Down
127 changes: 86 additions & 41 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Contributing to Nacos

Welcome to Nacos! This document is a guideline about how to contribute to Nacos.

If you find something incorrect or missing, please leave comments / suggestions.

## Before you get started
Expand All @@ -9,71 +10,115 @@ If you find something incorrect or missing, please leave comments / suggestions.

Please make sure to read and observe our [Code of Conduct](./CODE_OF_CONDUCT.md).


## Contributing

We are always very happy to have contributions, whether for typo fix, bug fix or big new features.
Please do not ever hesitate to ask a question or send a pull request.
Nacos welcome new participants of any role, including user, contributor, committer and PMC.

We strongly value documentation and integration with other projects such as Spring Cloud, Kubernetes, Dubbo, etc.
We are very glad to accept improvements for these aspects.
![](http://acm-public.oss-cn-hangzhou.aliyuncs.com/contributor_definition.png)


### Open or Pickup an issue / PR
We encourage new comers actively join in Nacos projects and involving from user role to committer role, and even PMC role. In order to accomplish this, new comers needs to actively contribute in Nacos project. The following paragraph introduce how to contribute in Nacos way.

We use [GitHub Issues](https://github.com/alibaba/Nacos/issues) and [Pull Requests](https://github.com/alibaba/Nacos/pulls) for trackers.
#### Open / pickup an issue for preparation

If you find a typo in document, find a bug in code, or want new features, or want to give suggestions,
you can [open an issue on GitHub](https://github.com/alibaba/Nacos/issues/new) to report it.
Please follow the guideline message in the issue template.
If you find a typo in document, find a bug in code, or want new features, or want to give suggestions, you can [open an issue on GitHub](https://github.com/alibaba/Nacos/issues/new) to report it.

If you just want to contribute directly you can choose the issue below.

- [Contribution Welcome](https://github.com/alibaba/nacos/labels/contribution%20welcome): Heavily needed issue, but currently short of hand.
- [good first issue](https://github.com/alibaba/nacos/labels/good%20first%20issue): Good for newcomers, new comer can pickup one for warm-up.
Now if you want to contribute, please follow the [contribution workflow](#github-workflow) and create a new pull request.
- [Contribution Welcome](https://github.com/alibaba/nacos/labels/contribution%20welcome): Heavily needed issue, but currently short of hand.
- [good first issue](https://github.com/alibaba/nacos/labels/good%20first%20issue): Good for newcomers, new comer can pickup one for warm-up.

### Begin your contribution
We strongly value documentation and integration with other projects such as Spring Cloud, Kubernetes, Dubbo, etc. We are very glad to work on any issue for these aspects.

We use the `develop` branch as the development branch, which indicates that this is a unstable branch.
Please note that any PR must be associated with a valid issue. Otherwise the PR will be rejected.

Here is the workflow for contributors:
#### Begin your contribute

1. Fork to your own
2. Clone fork to local repository
3. Create a new branch and work on it
4. Keep your branch in sync
5. Commit your changes (make sure your commit message concise)
6. Push your commits to your forked repository
7. Create a pull request.
Now if you want to contribute, please create a new pull request.

When creating pull request:
We use the `develop` branch as the development branch, which indicates that this is a unstable branch.

1. Please follow [the pull request template](./.github/PULL_REQUEST_TEMPLATE.md).
2. Please make sure the PR has a corresponding issue.
3. If your PR contains large changes, e.g. component refactor or new components, please write detailed documents
about its design and usage.
4. Note that a single PR should not be too large. If heavy changes are required, it's better to separate the changes
to a few individual PRs.
5. After creating a PR, one or more reviewers will be assigned to the pull request.
6. Before merging a PR, squash any fix review feedback, typo, merged, and rebased sorts of commits.
The final commit message should be clear and concise.
Further more, our branching model complies to [https://nvie.com/posts/a-successful-git-branching-model/](https://nvie.com/posts/a-successful-git-branching-model/). We strongly suggest new comers walk through the above article before creating PR.

Now, if you are ready to create PR, here is the workflow for contributors:

1. Fork to your own

2. Clone fork to local repository

3. Create a new branch and work on it

4. Keep your branch in sync

5. Commit your changes (make sure your commit message concise)

6. Push your commits to your forked repository

7. Create a pull request to **develop** branch.


When creating pull request:

If your PR contains large changes, e.g. component refactor or new components, please write detailed documents
about its design and usage.
1. Please follow [the pull request template](./.github/PULL_REQUEST_TEMPLATE.md).

2. Please create the request to **develop** branch.

3. Please make sure the PR has a corresponding issue.

4. If your PR contains large changes, e.g. component refactor or new components, please write detailed documents about its design and usage.

5. Note that a single PR should not be too large. If heavy changes are required, it's better to separate the changes to a few individual PRs.

6. After creating a PR, one or more reviewers will be assigned to the pull request.

7. Before merging a PR, squash any fix review feedback, typo, merged, and rebased sorts of commits. The final commit message should be clear and concise.


If your PR contains large changes, e.g. component refactor or new components, please write detailed documents about its design and usage.

### Code review guidance

Our PMC will rotate reviewing the code to make sure all the PR will be reviewed timely and by at least one committer before merge. If we aren't doing our job (sometimes we drop things). And as always, we welcome volunteers for code review.
Committers will rotate reviewing the code to make sure all the PR will be reviewed timely and by at least one committer before merge. If we aren't doing our job (sometimes we drop things). And as always, we welcome volunteers for code review.

Some principles:

- Readability - Important code should be well-documented. API should have Javadoc. Code style should be complied with the existing one.
- Elegance: New functions, classes or components should be well designed.
- Testability - 80% of the new code should be covered by unit test cases.
- Maintainability - Comply with our [PMD spec](style/codeStyle.xml), and 3-month-frequency update should be maintained at least.
- Readability - Important code should be well-documented. API should have Javadoc. Code style should be complied with the existing one.

- Elegance: New functions, classes or components should be well designed.

- Testability - 80% of the new code should be covered by unit test cases.

- Maintainability - Comply with our [PMD spec](style/codeStyle.xml), and 3-month-frequency update should be maintained at least.


### Now how about try become a committer?

Generally speaking, contribute 8 non-trivial patches and get at least three different people to review them (you'll need three people to support you). Then ask someone to nominate you. You're demonstrating your:

- at least 8 PR and the associated issues to the project,

- ability to collaborate with the team,

- understanding of the projects' code base and coding style, and

- ability to write good code (last but certainly not least)


A current committer nominates you by slacking the team on the Nacos issue with label "nomination"

- your first and last name

- a link to your Git profile

- an explanation of why you should be a committer,

- Elaborate the top 3 PR and the associated issues the nominator has worked with you that can demonstrate your ability.


Two other committer need to second your nomination. If no one objects in 5 working days (China), you're a committer. If anyone objects or wants more information, the committers discuss and usually come to a consensus (within the 5 working days). If issues cannot be resolved, there's a vote among current committers.

![](http://acm-public.oss-cn-hangzhou.aliyuncs.com/nomination_process.png)

In the worst case, this can drag out for two weeks. Keep contributing! Even in the rare cases where a nomination fails, the objection is usually something easy to address like "more patches" or "not enough people are familiar with this person's work."
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ It is super easy to get started with your first project.

You can download the package from the [latest stable release](https://github.com/alibaba/nacos/releases).

Take release nacos-server-0.6.1.zip for example.
Take release nacos-server-0.7.0.zip for example.
```
unzip nacos-server-0.6.1.zip
unzip nacos-server-0.7.0.zip
cd nacos/bin
```

Expand Down
8 changes: 4 additions & 4 deletions api/src/main/java/com/alibaba/nacos/api/NacosFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
public class NacosFactory {

/**
* Create config
* Create config service
*
* @param properties init param
* @return config
Expand All @@ -42,7 +42,7 @@ public static ConfigService createConfigService(Properties properties) throws Na
}

/**
* Create config
* Create config service
*
* @param serverAddr server list
* @return config
Expand All @@ -53,7 +53,7 @@ public static ConfigService createConfigService(String serverAddr) throws NacosE
}

/**
* Create Naming
* Create naming service
*
* @param serverAddr server list
* @return Naming
Expand All @@ -64,7 +64,7 @@ public static NamingService createNamingService(String serverAddr) throws NacosE
}

/**
* Create Naming
* Create naming service
*
* @param properties init param
* @return Naming
Expand Down
10 changes: 9 additions & 1 deletion api/src/main/java/com/alibaba/nacos/api/PropertyKeyConst.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,28 @@
package com.alibaba.nacos.api;

/**
* properties key
* Property Key Const
*
* @author Nacos
*/
public class PropertyKeyConst {

public final static String ENDPOINT = "endpoint";

public final static String NAMESPACE = "namespace";

public final static String ACCESS_KEY = "accessKey";

public final static String SECRET_KEY = "secretKey";

public final static String SERVER_ADDR = "serverAddr";

public final static String CONTEXT_PATH = "contextPath";

public final static String CLUSTER_NAME = "clusterName";

public final static String ENCODE = "encode";

public final static String NAMING_LOAD_CACHE_AT_START = "namingLoadCacheAtStart";

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
*/
public enum PreservedEntityTypes {
/**
*
* Ip
*/
ip,
/**
*
* Service
*/
service
}
5 changes: 0 additions & 5 deletions api/src/main/java/com/alibaba/nacos/api/common/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ public class Constants {
*/
public static final int ONCE_TIMEOUT = 2000;

/**
* millisecond
*/
public static final int CONN_TIMEOUT = 2000;

/**
* millisecond
*/
Expand Down
17 changes: 5 additions & 12 deletions api/src/main/java/com/alibaba/nacos/api/config/ConfigFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ public class ConfigFactory {
* Create Config
*
* @param properties init param
* @return Config
* @return ConfigService
* @throws NacosException Exception
*/
public static ConfigService createConfigService(Properties properties) throws NacosException {
try {
Class<?> driverImplClass = Class.forName("com.alibaba.nacos.client.config.NacosConfigService");
Constructor constructor = driverImplClass.getConstructor(Properties.class);
ConfigService vendorImpl = (ConfigService)constructor.newInstance(properties);
ConfigService vendorImpl = (ConfigService) constructor.newInstance(properties);
return vendorImpl;
} catch (Throwable e) {
throw new NacosException(-400, e.getMessage());
Expand All @@ -49,21 +49,14 @@ public static ConfigService createConfigService(Properties properties) throws Na
/**
* Create Config
*
* @param ServerAddr serverlist
* @param serverAddr serverList
* @return Config
* @throws NacosException Exception
* @throws ConfigService Exception
*/
public static ConfigService createConfigService(String serverAddr) throws NacosException {
Properties properties = new Properties();
properties.put(PropertyKeyConst.SERVER_ADDR, serverAddr);
try {
Class<?> driverImplClass = Class.forName("com.alibaba.nacos.client.config.NacosConfigService");
Constructor constructor = driverImplClass.getConstructor(Properties.class);
ConfigService vendorImpl = (ConfigService)constructor.newInstance(properties);
return vendorImpl;
} catch (Throwable e) {
throw new NacosException(-400, e.getMessage());
}
return createConfigService(properties);
}

}
Loading

0 comments on commit fb5bbf3

Please sign in to comment.