Skip to content

Commit

Permalink
chore: add independent submodules (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
Enda authored Aug 17, 2021
1 parent 2a23d42 commit 2faf56d
Show file tree
Hide file tree
Showing 29 changed files with 2,381 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .chglog/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/redhat-developer/app-services-cli
repository_url: https://github.com/redhat-developer/app-services-sdk-go
options:
tag_filter_pattern: '^v?[0-9]+\.[0-9]+\.[0-9]+$'
commits:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build_and_validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- name: Check Go modules match source code
run: ./scripts/go-mod-check.sh
- name: golangci-lint
if: steps.filter.outputs.go == 'true'
uses: golangci/golangci-lint-action@v2
Expand Down
7 changes: 0 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
2. Bot accounts creates PR with the new versions of the SDK that needs be reviewed by the team
3. Once PR is merged developers are responsible for creating tagged release


## Release process

1. Check what SDK changed
2. Create tag
3. Generate changelog and put it into release description

## Contributing to App Services SDK

## Generating an API client locally
Expand Down
59 changes: 59 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Releasing

## Determing which module to release

The Go client libraries have several modules. If a file needs to be releases, you must release the closest ancestor module.

To see all modules:

```bash
$ cat `find . -name go.mod` | grep module
module github.com/redhat-developer/app-services-sdk-go/internal/apigen
module github.com/redhat-developer/app-services-sdk-go/internal/examples
module github.com/redhat-developer/app-services-sdk-go/kafkainstance
module github.com/redhat-developer/app-services-sdk-go/kafkamgmt
module github.com/redhat-developer/app-services-sdk-go/registrymgmt
module github.com/redhat-developer/app-services-sdk-go/connectormgmt
module github.com/redhat-developer/app-services-sdk-go/registryinstance
module github.com/redhat-developer/app-services-sdk-go
```

The `github.com/redhat-developer/app-services-sdk-go` is the repository root module. Each other module is a submodule.

If you need to release a change in `registrymgmt/apiv1/api_client.go`, the closest ancestor module is `github.com/redhat-developer/app-services-sdk-go/registrymgmt`, so you would need to release a new version of the `github.com/redhat-developer/app-services-sdk-go/registrymgmt` submodule.

If you need to release a change in `auth/oauth2/endpoint.go`, the closest ancestor module is `github.com/redhat-developer/app-services-sdk-go`, so you would need to release a new version of the `github.com/redhat-developer/app-services-sdk-go` repository root module. Note: releasing `github.com/redhat-developer/app-services-sdk-go` has no impact on any of the submodules, and vice-versa. They are release entirely independently.

## How to release

### Manual Release (`github.com/redhat-developer/app-services-sdk-go`)

**Requirements**

1. Navigate to the repository root and switch to `main`.
1. Run `git tag -l | grep -v beta | grep -v alpha` to see all existing releases. The current latest tag `$CURRENT_VERSION` is the largest tag. It should look like `vX.Y.Z` (note: ignore all `LIB/vX.Y.Z tags` - these are the tags for a specific submodule, not the root module). We'll call the current version `$CURRENT_VERSION` and the next version `$NEXT_VERSION`.
2. On `main`, run `git log $CURRENT_VERSION...` to list all the changes since the last release. Note: You must manually visually parse out changes to submodules (the git log is going to show you things in submodules, which are not going to be part of your release).
3. Edit `CHANGELOG.md` to include the summary of changes from the previous step.
4. Commit the changes, push to your fork and create a PR titled: `chore: release $NEXT_VERSION`.
5. Wait for the PR to be reviewed and merged. Once it's merged, and without merging any other PRs in the meantime:
a. Switch the main branch
b. Pull the latest changes
c. Tag the repo with the next version: `git tag $NEXT_VERSION`
d. Push the tag to origin: `git push origin $NEXT_VERSION`
6. Update the [releases page](https://github.com/redhat-developer/app-services-sdk-go/releases) with the new release, copying the contents of `CHANGELOG.md`.

### Manual Releases (submodules)

These steps assume we're releasing `github.com/redhat-developer/app-services-sdk-go/kafkamgmt` - change this value to be whichever module you are releasing.

1. Navigate to the repository root and switch to `main`.
1. Run `git tag -l | grep kafkamgmt | grep -v beta | grep -v alpha` to see all existing releases. The current latest tag `$CURRENT_VERSION` is the largest tag. It should look like `kafkamgmt/vX.Y.Z` (note: ignore all `LIB/vX.Y.Z tags` - these are the tags for a specific submodule, not the root module). We'll call the current version `$CURRENT_VERSION` and the next version `$NEXT_VERSION`.
2. On `main`, run `git log $CURRENT_VERSION.. -- kafkamgmt/` to list all the changes since the last release.
3. Edit `kafkamgmt/CHANGELOG.md` to include the summary of changes from the previous step.
4. Commit the changes, push to your fork and create a PR titled: `chore: release $NEXT_VERSION`. Note: The version of a submodule should be prefixed with the module name, e.g: `kafkamgmt/v1.0.1`
5. Wait for the PR to be reviewed and merged. Once it's merged, and without merging any other PRs in the meantime:
a. Switch the main branch
b. Pull the latest changes
c. Tag the repo with the next version: `git tag $NEXT_VERSION`
d. Push the tag to origin: `git push origin $NEXT_VERSION`
6. Update the [releases page](https://github.com/redhat-developer/app-services-sdk-go/releases) with the new release, copying the contents of `kafkamgmt/CHANGELOG.md`.
2 changes: 1 addition & 1 deletion endpoint.go → auth/oauth2/endpoint.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package rhoas
package oauth2

import "golang.org/x/oauth2"

Expand Down
13 changes: 10 additions & 3 deletions connectormgmt/apiv1/api_client.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
package connectormgmt

import (
"github.com/redhat-developer/app-services-sdk-go/internal"
"net/http"

apiv1 "github.com/redhat-developer/app-services-sdk-go/connectormgmt/apiv1/client"
)

// APIConfig defines the available configuration options
// Config defines the available configuration options
// to customise the API client settings
type Config = internal.APIConfig
type Config struct {
// HTTPClient is a custom HTTP client
HTTPClient *http.Client
// Debug enables debug-level logging
Debug bool
// BaseURL sets a custom API server base URL
BaseURL string
}

// NewAPIClient returns a new ConnectorManagement v1 API client
// using a custom config
Expand Down
5 changes: 5 additions & 0 deletions connectormgmt/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/redhat-developer/app-services-sdk-go/connectormgmt

go 1.13

require golang.org/x/oauth2 v0.0.0-20210810183815-faf39c7919d5
Loading

0 comments on commit 2faf56d

Please sign in to comment.