Skip to content

Commit 6837370

Browse files
author
Dillon Giacoppo
committed
Release v1.0.0
0 parents  commit 6837370

23 files changed

+2849
-0
lines changed

.travis.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Adapted from https://gist.github.com/y0ssar1an/df2dab474520c4086926f672c52db139
2+
language: go
3+
4+
# Only the last two Go releases are supported by the Go team with security
5+
# updates. Any versions older than that should be considered deprecated.
6+
# Don't bother testing with them. tip builds your code with the latest
7+
# development version of Go. This can warn you that your code will break
8+
# in the next version of Go. Don't worry! Later we declare that test runs
9+
# are allowed to fail on Go tip.
10+
go:
11+
- 1.10
12+
- master
13+
14+
matrix:
15+
# It's ok if our code fails on unstable development versions of Go.
16+
allow_failures:
17+
- go: master
18+
# Don't wait for tip tests to finish. Mark the test run green if the
19+
# tests pass on the stable versions of Go.
20+
fast_finish: true
21+
22+
# Don't email me the results of the test runs.
23+
notifications:
24+
email: false
25+
26+
env:
27+
- DEP_VERSION="0.4.1"
28+
29+
before_install:
30+
# Download the binary to bin folder in $GOPATH
31+
- curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep
32+
# Make the binary executable
33+
- chmod +x $GOPATH/bin/dep
34+
35+
install:
36+
- dep ensure
37+
38+
# Anything in before_script that returns a nonzero exit code will
39+
# flunk the build and immediately stop. It's sorta like having
40+
# set -e enabled in bash.
41+
before_script:
42+
- GO_FILES=( $(find . -iname '*.go' -type f | grep -v /vendor/) ) # All the .go files, excluding vendor/
43+
- go get honnef.co/go/tools/cmd/megacheck # Badass static analyzer/linter
44+
- go get github.com/fzipp/gocyclo
45+
46+
# script always run to completion (set +e). All of these code checks are must haves
47+
# in a modern Go project.
48+
script:
49+
- test -z $(gofmt -s -l $GO_FILES) # Fail if a .go file hasn't been formatted with gofmt
50+
- go test -v -race ./... # Run all the tests with the race detector enabled
51+
- go vet ./... # go vet is the official Go static analyzer
52+
- megacheck ./... # "go vet on steroids" + linter
53+
- gocyclo -over 19 $GO_FILES # forbid code with huge functions

CODE_OF_CONDUCT.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Contributor Code of Conduct
2+
3+
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4+
5+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
6+
7+
Examples of unacceptable behavior by participants include:
8+
9+
* The use of sexualized language or imagery
10+
* Personal attacks
11+
* Trolling or insulting/derogatory comments
12+
* Public or private harassment
13+
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
14+
* Submitting contributions or comments that you know to violate the intellectual property or privacy rights of others
15+
* Other unethical or unprofessional conduct
16+
17+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
18+
By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
19+
20+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
21+
22+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a project maintainer. Complaints will result in a response and be reviewed and investigated in a way that is deemed necessary and appropriate to the circumstances. Maintainers are obligated to maintain confidentiality with regard to the reporter of an incident.
23+
24+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.3.0, available at [http://contributor-covenant.org/version/1/3/0/][version]
25+
26+
[homepage]: http://contributor-covenant.org
27+
[version]: http://contributor-covenant.org/version/1/3/0/

CONTRIBUTING.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Contributing to go-artifactory
2+
3+
## Reporting Issues
4+
5+
This section guides you through submitting a bug report for go-artifactory. Following these guidelines helps us and the community understand your issue, reproduce the behavior, and find related issues.
6+
7+
When you are creating an issue, please include as many details as possible.
8+
9+
### Before submitting an issue
10+
11+
* **Perform a [cursory search][IssueTracker]** to see if the problem has already been reported. If it has, add a comment to the existing issue instead of opening a new one.
12+
13+
### How do I submit a (good) issue?
14+
15+
* **Use a clear and descriptive title** for the issue to identify the problem.
16+
* **Describe the exact steps which reproduce the problem** in as many details as possible. When listing steps, **don't just say what you did, but explain how you did it**. For example, if you opened a inline dialog, explain if you used the mouse, or a keyboard shortcut.
17+
* **If the problem wasn't triggered by a specific action**, describe what you were doing before the problem happened and share more information using the guidelines below.
18+
19+
Include details about your configuration and environment:
20+
21+
* **Which OS are you running on?**
22+
* **What version of golang are you using**?
23+
24+
### Code Contributions
25+
26+
#### Why should I contribute?
27+
28+
1. While we strive to look at new issues as soon as we can, because of the many priorities we juggle and limited resources, issues raised often don't get looked into soon enough.
29+
2. We want your contributions. We are always trying to improve our docs, processes and tools to make it easier to submit your own changes.
30+
3. At Atlassian, "Play, As A Team" is one of our values. We encourage cross team contributions and collaborations.
31+
32+
Please raise a new issue [here][IssueTracker].
33+
34+
### Follow code style guidelines
35+
36+
It is recommended you use the git hooks found in the misc directory, this will include go-fmt
37+
38+
## Merge into master
39+
All new feature code must be completed in a feature branch and have a corresponding Feature or Bug issue in the go-artifactory project.
40+
41+
Once you are happy with your changes, you must push your branch to Bitbucket and create a pull request. All pull requests must have at least 2 reviewers from the go-artifactory team. Once the pull request has been approved it may be merged into develop.
42+
43+
A separate pull request can be made to create a release and merge develop into master.
44+
45+
Each PR should consist of exactly one commit, use git rebase and squash, and should be as small as possible. If you feel multiple commits are warrented you should probably be filing them as multiple PRs.
46+
47+
**Attention!**: *Merging into master will automatically release a component. See below for more details*
48+
49+
## Release a component
50+
Releasing components is completely automated. The process of releasing will begin when changes are made to the `master` branch:
51+
52+
* Pipelines will move the go branch forward after successful build on master. This will change the version acquired by go-get
53+
54+
## Root dependencies
55+
56+
go-artifactory endeavours to avoid external dependencies and be lightweight.
57+
58+
[IssueTracker]: https://github.com/atlassian/go-artifactory/issues

Gopkg.lock

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
# Gopkg.toml example
3+
#
4+
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
5+
# for detailed Gopkg.toml documentation.
6+
#
7+
# required = ["github.com/user/thing/cmd/thing"]
8+
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
9+
#
10+
# [[constraint]]
11+
# name = "github.com/user/project"
12+
# version = "1.0.0"
13+
#
14+
# [[constraint]]
15+
# name = "github.com/user/project2"
16+
# branch = "dev"
17+
# source = "github.com/myfork/project2"
18+
#
19+
# [[override]]
20+
# name = "github.com/x/y"
21+
# version = "2.4.0"
22+
23+
24+
[[constraint]]
25+
branch = "master"
26+
name = "github.com/google/go-querystring"
27+
28+
[[constraint]]
29+
name = "github.com/stretchr/testify"
30+
version = "1.2.1"

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright @ 2018 Atlassian Pty Ltd
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
all: install-hooks test
2+
3+
install-hooks:
4+
@misc/scripts/install-hooks
5+
6+
dep:
7+
@misc/scripts/deps-ensure
8+
@dep ensure -v
9+
10+
test:
11+
@go test -v ./pkg/...

README.md

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# go-artifactory #
2+
go-artifactory is a Go client library for accessing the [Artifactory API](https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API)
3+
4+
go-artifactory is tested on Go version 1.9
5+
6+
## Usage ##
7+
```go
8+
import "github.com/atlassian/go-artifactory/pkg/artifactory"
9+
```
10+
11+
Construct a new Artifactory client, then use the various services on the client to
12+
access different parts of the Artifactory API. For example:
13+
14+
```go
15+
client := artifactory.NewClient("http://localhost/artifactory", nil)
16+
17+
// list all repositories
18+
repos, resp, err := client.Repositories.List(context.Background(), nil)
19+
```
20+
21+
Some API methods have optional parameters that can be passed. For example:
22+
23+
```go
24+
client := artifactroy.NewClient("http://localhost/artifactory", nil)
25+
26+
// list all public local repositories
27+
opt := &artifactory.RepositoryListOptions{Type: "local"}
28+
client.Repositories.ListRepositories(ctx, opt)
29+
```
30+
31+
The services of a client divide the API into logical chunks and correspond to
32+
the structure of the Artifactory API documentation at
33+
[https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API](https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API).
34+
35+
NOTE: Using the [context](https://godoc.org/context) package, one can easily
36+
pass cancelation signals and deadlines to various services of the client for
37+
handling a request. In case there is no context available, then `context.Background()`
38+
can be used as a starting point.
39+
40+
### Authentication ###
41+
42+
The go-artifactory library does not directly handle authentication. Instead, when
43+
creating a new client, pass an `http.Client` that can handle authentication for
44+
you.
45+
46+
For API methods that require HTTP Basic Authentication, use the BasicAuthTransport or TokenTransport
47+
48+
```go
49+
package main
50+
51+
import (
52+
"github.com/atlassian/go-artifactory/pkg/artifactory"
53+
"fmt"
54+
"context"
55+
)
56+
57+
func main() {
58+
tp := artifactory.BasicAuthTransport{
59+
Username: "<YOUR_USERNAME>",
60+
Password: "<YOUR_PASSWORD>",
61+
}
62+
63+
client, err := artifactory.NewClient("https://localhost/artifactory", tp.Client())
64+
if err != nil {
65+
fmt.Println(err.Error())
66+
}
67+
68+
repos, resp, err := client.Repositories.ListRepositories(context.Background(), nil)
69+
}
70+
```
71+
72+
### Creating and Updating Resources ###
73+
All structs for GitHub resources use pointer values for all non-repeated fields.
74+
This allows distinguishing between unset fields and those set to a zero-value.
75+
Helper functions have been provided to easily create these pointers for string,
76+
bool, and int values. For example:
77+
78+
```go
79+
// create a new local repository named "lib-releases"
80+
repo := artifactory.LocalRepository{
81+
Key: artifactory.String("lib-releases"),
82+
RClass: artifactory.String("local"),
83+
PackageType: artifactory.String("maven"),
84+
HandleSnapshots: artifactory.Bool(false);
85+
}
86+
87+
client.Repositories.CreateLocal(context.Background(), &repo)
88+
```
89+
90+
Users who have worked with protocol buffers should find this pattern familiar.
91+
92+
## Roadmap ##
93+
94+
This library is being initially developed for an internal application at
95+
Atlassian, so API methods will likely be implemented in the order that they are
96+
needed by that application. Eventually, it would be ideal to cover the entire
97+
Artifactory API, so contributions are of course always welcome. The
98+
calling pattern is pretty well established, so adding new methods is relatively
99+
straightforward.
100+
101+
## Versioning ##
102+
103+
In general, go-artifactory follows [semver](https://semver.org/) as closely as we
104+
can for tagging releases of the package. For self-contained libraries, the
105+
application of semantic versioning is relatively straightforward and generally
106+
understood. But because go-artifactory is a client library for the Artifactory API
107+
we've adopted the following versioning policy:
108+
109+
* We increment the **major version** with any incompatible change to
110+
functionality, including changes to the exported Go API surface
111+
or behavior of the API.
112+
* We increment the **minor version** with any backwards-compatible changes to
113+
functionality.
114+
* We increment the **patch version** with any backwards-compatible bug fixes.
115+
116+
Generally methods will be annotated with a since version.
117+
118+
## Reporting issues ##
119+
120+
We believe in open contributions and the power of a strong development community. Please read our [Contributing guidelines][CONTRIBUTING] on how to contribute back and report issues to go-stride.
121+
122+
## Contributors ##
123+
124+
Pull requests, issues and comments are welcomed. For pull requests:
125+
126+
* Add tests for new features and bug fixes
127+
* Follow the existing style
128+
* Separate unrelated changes into multiple pull requests
129+
* Read [Contributing guidelines][CONTRIBUTING] for more details
130+
131+
See the existing issues for things to start contributing.
132+
133+
For bigger changes, make sure you start a discussion first by creating
134+
an issue and explaining the intended change.
135+
136+
Atlassian requires contributors to sign a Contributor License Agreement,
137+
known as a CLA. This serves as a record stating that the contributor is
138+
entitled to contribute the code/documentation/translation to the project
139+
and is willing to have it used in distributions and derivative works
140+
(or is willing to transfer ownership).
141+
142+
Prior to accepting your contributions we ask that you please follow the appropriate
143+
link below to digitally sign the CLA. The Corporate CLA is for those who are
144+
contributing as a member of an organization and the individual CLA is for
145+
those contributing as an individual.
146+
147+
* [CLA for corporate contributors](https://na2.docusign.net/Member/PowerFormSigning.aspx?PowerFormId=e1c17c66-ca4d-4aab-a953-2c231af4a20b)
148+
* [CLA for individuals](https://na2.docusign.net/Member/PowerFormSigning.aspx?PowerFormId=3f94fbdc-2fbe-46ac-b14c-5d152700ae5d)
149+
150+
151+
## License ##
152+
Copyright (c) 2017 Atlassian and others. Apache 2.0 licensed, see [LICENSE][LICENSE] file.
153+
154+
155+
[CONTRIBUTING]: ./CONTRIBUTING.md
156+
[LICENSE]: ./LICENSE.txt

0 commit comments

Comments
 (0)