Skip to content

Commit

Permalink
Release v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Dillon Giacoppo committed Apr 11, 2018
0 parents commit 6837370
Show file tree
Hide file tree
Showing 23 changed files with 2,849 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Adapted from https://gist.github.com/y0ssar1an/df2dab474520c4086926f672c52db139
language: go

# Only the last two Go releases are supported by the Go team with security
# updates. Any versions older than that should be considered deprecated.
# Don't bother testing with them. tip builds your code with the latest
# development version of Go. This can warn you that your code will break
# in the next version of Go. Don't worry! Later we declare that test runs
# are allowed to fail on Go tip.
go:
- 1.10
- master

matrix:
# It's ok if our code fails on unstable development versions of Go.
allow_failures:
- go: master
# Don't wait for tip tests to finish. Mark the test run green if the
# tests pass on the stable versions of Go.
fast_finish: true

# Don't email me the results of the test runs.
notifications:
email: false

env:
- DEP_VERSION="0.4.1"

before_install:
# Download the binary to bin folder in $GOPATH
- curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep
# Make the binary executable
- chmod +x $GOPATH/bin/dep

install:
- dep ensure

# Anything in before_script that returns a nonzero exit code will
# flunk the build and immediately stop. It's sorta like having
# set -e enabled in bash.
before_script:
- GO_FILES=( $(find . -iname '*.go' -type f | grep -v /vendor/) ) # All the .go files, excluding vendor/
- go get honnef.co/go/tools/cmd/megacheck # Badass static analyzer/linter
- go get github.com/fzipp/gocyclo

# script always run to completion (set +e). All of these code checks are must haves
# in a modern Go project.
script:
- test -z $(gofmt -s -l $GO_FILES) # Fail if a .go file hasn't been formatted with gofmt
- go test -v -race ./... # Run all the tests with the race detector enabled
- go vet ./... # go vet is the official Go static analyzer
- megacheck ./... # "go vet on steroids" + linter
- gocyclo -over 19 $GO_FILES # forbid code with huge functions
27 changes: 27 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Contributor Code of Conduct

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.

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.

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
* Submitting contributions or comments that you know to violate the intellectual property or privacy rights of others
* Other unethical or unprofessional conduct

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.
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.

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.

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.

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]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/3/0/
58 changes: 58 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Contributing to go-artifactory

## Reporting Issues

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.

When you are creating an issue, please include as many details as possible.

### Before submitting an issue

* **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.

### How do I submit a (good) issue?

* **Use a clear and descriptive title** for the issue to identify the problem.
* **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.
* **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.

Include details about your configuration and environment:

* **Which OS are you running on?**
* **What version of golang are you using**?

### Code Contributions

#### Why should I contribute?

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.
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.
3. At Atlassian, "Play, As A Team" is one of our values. We encourage cross team contributions and collaborations.

Please raise a new issue [here][IssueTracker].

### Follow code style guidelines

It is recommended you use the git hooks found in the misc directory, this will include go-fmt

## Merge into master
All new feature code must be completed in a feature branch and have a corresponding Feature or Bug issue in the go-artifactory project.

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.

A separate pull request can be made to create a release and merge develop into master.

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.

**Attention!**: *Merging into master will automatically release a component. See below for more details*

## Release a component
Releasing components is completely automated. The process of releasing will begin when changes are made to the `master` branch:

* Pipelines will move the go branch forward after successful build on master. This will change the version acquired by go-get

## Root dependencies

go-artifactory endeavours to avoid external dependencies and be lightweight.

[IssueTracker]: https://github.com/atlassian/go-artifactory/issues
33 changes: 33 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"


[[constraint]]
branch = "master"
name = "github.com/google/go-querystring"

[[constraint]]
name = "github.com/stretchr/testify"
version = "1.2.1"
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright @ 2018 Atlassian Pty Ltd

Licensed 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.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
all: install-hooks test

install-hooks:
@misc/scripts/install-hooks

dep:
@misc/scripts/deps-ensure
@dep ensure -v

test:
@go test -v ./pkg/...
156 changes: 156 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# go-artifactory #
go-artifactory is a Go client library for accessing the [Artifactory API](https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API)

go-artifactory is tested on Go version 1.9

## Usage ##
```go
import "github.com/atlassian/go-artifactory/pkg/artifactory"
```

Construct a new Artifactory client, then use the various services on the client to
access different parts of the Artifactory API. For example:

```go
client := artifactory.NewClient("http://localhost/artifactory", nil)

// list all repositories
repos, resp, err := client.Repositories.List(context.Background(), nil)
```

Some API methods have optional parameters that can be passed. For example:

```go
client := artifactroy.NewClient("http://localhost/artifactory", nil)

// list all public local repositories
opt := &artifactory.RepositoryListOptions{Type: "local"}
client.Repositories.ListRepositories(ctx, opt)
```

The services of a client divide the API into logical chunks and correspond to
the structure of the Artifactory API documentation at
[https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API](https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API).

NOTE: Using the [context](https://godoc.org/context) package, one can easily
pass cancelation signals and deadlines to various services of the client for
handling a request. In case there is no context available, then `context.Background()`
can be used as a starting point.

### Authentication ###

The go-artifactory library does not directly handle authentication. Instead, when
creating a new client, pass an `http.Client` that can handle authentication for
you.

For API methods that require HTTP Basic Authentication, use the BasicAuthTransport or TokenTransport

```go
package main

import (
"github.com/atlassian/go-artifactory/pkg/artifactory"
"fmt"
"context"
)

func main() {
tp := artifactory.BasicAuthTransport{
Username: "<YOUR_USERNAME>",
Password: "<YOUR_PASSWORD>",
}

client, err := artifactory.NewClient("https://localhost/artifactory", tp.Client())
if err != nil {
fmt.Println(err.Error())
}

repos, resp, err := client.Repositories.ListRepositories(context.Background(), nil)
}
```

### Creating and Updating Resources ###
All structs for GitHub resources use pointer values for all non-repeated fields.
This allows distinguishing between unset fields and those set to a zero-value.
Helper functions have been provided to easily create these pointers for string,
bool, and int values. For example:

```go
// create a new local repository named "lib-releases"
repo := artifactory.LocalRepository{
Key: artifactory.String("lib-releases"),
RClass: artifactory.String("local"),
PackageType: artifactory.String("maven"),
HandleSnapshots: artifactory.Bool(false);
}

client.Repositories.CreateLocal(context.Background(), &repo)
```

Users who have worked with protocol buffers should find this pattern familiar.

## Roadmap ##

This library is being initially developed for an internal application at
Atlassian, so API methods will likely be implemented in the order that they are
needed by that application. Eventually, it would be ideal to cover the entire
Artifactory API, so contributions are of course always welcome. The
calling pattern is pretty well established, so adding new methods is relatively
straightforward.

## Versioning ##

In general, go-artifactory follows [semver](https://semver.org/) as closely as we
can for tagging releases of the package. For self-contained libraries, the
application of semantic versioning is relatively straightforward and generally
understood. But because go-artifactory is a client library for the Artifactory API
we've adopted the following versioning policy:

* We increment the **major version** with any incompatible change to
functionality, including changes to the exported Go API surface
or behavior of the API.
* We increment the **minor version** with any backwards-compatible changes to
functionality.
* We increment the **patch version** with any backwards-compatible bug fixes.

Generally methods will be annotated with a since version.

## Reporting issues ##

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.

## Contributors ##

Pull requests, issues and comments are welcomed. For pull requests:

* Add tests for new features and bug fixes
* Follow the existing style
* Separate unrelated changes into multiple pull requests
* Read [Contributing guidelines][CONTRIBUTING] for more details

See the existing issues for things to start contributing.

For bigger changes, make sure you start a discussion first by creating
an issue and explaining the intended change.

Atlassian requires contributors to sign a Contributor License Agreement,
known as a CLA. This serves as a record stating that the contributor is
entitled to contribute the code/documentation/translation to the project
and is willing to have it used in distributions and derivative works
(or is willing to transfer ownership).

Prior to accepting your contributions we ask that you please follow the appropriate
link below to digitally sign the CLA. The Corporate CLA is for those who are
contributing as a member of an organization and the individual CLA is for
those contributing as an individual.

* [CLA for corporate contributors](https://na2.docusign.net/Member/PowerFormSigning.aspx?PowerFormId=e1c17c66-ca4d-4aab-a953-2c231af4a20b)
* [CLA for individuals](https://na2.docusign.net/Member/PowerFormSigning.aspx?PowerFormId=3f94fbdc-2fbe-46ac-b14c-5d152700ae5d)


## License ##
Copyright (c) 2017 Atlassian and others. Apache 2.0 licensed, see [LICENSE][LICENSE] file.


[CONTRIBUTING]: ./CONTRIBUTING.md
[LICENSE]: ./LICENSE.txt
Loading

0 comments on commit 6837370

Please sign in to comment.