Skip to content

Commit

Permalink
Merge branch 'main' into mapbu-oss-review-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
DanieldeR authored Oct 1, 2021
2 parents dfd2d16 + 1329c73 commit 911639c
Show file tree
Hide file tree
Showing 45 changed files with 553 additions and 428 deletions.
51 changes: 51 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,54 @@ ps.: those commands can be all specified at once, for instance:

[carvel Packaging]: https://carvel.dev/kapp-controller/docs/latest/packaging/
[imgpkg bundle]: https://carvel.dev/imgpkg/docs/latest/

## Contribution workflow

This section describes the process for contributing a bug fix or new feature.

### Before you submit a pull request

This project operates according to the _talk, then code_ rule.
If you plan to submit a pull request for anything more than a typo or obvious bug fix, first you _should_ [raise an issue][new-issue] to discuss your proposal, before submitting any code.

Depending on the size of the feature you may be expected to first write an RFC. Follow the [RFC Process](https://github.com/vmware-tanzu/cartographer/blob/main/rfc/README.md) documented in Cartographer's Governance.

### Commit message and PR guidelines

- Have a short subject on the first line and a body.
- Use the imperative mood (ie "If applied, this commit will (subject)" should make sense).
- Put a summary of the main area affected by the commit at the start,
with a colon as delimiter. For example 'docs:', 'extensions/(extensionname):', 'design:' or something similar.
- Do not merge commits that don't relate to the affected issue (e.g. "Updating from PR comments", etc). Should
the need to cherrypick a commit or rollback arise, it should be clear what a specific commit's purpose is.
- If the main branch has moved on, you'll need to rebase before we can merge,
so merging upstream main or rebasing from upstream before opening your
PR will probably save you some time.

Pull requests *must* include a `Fixes #NNNN` or `Updates #NNNN` comment.
Remember that `Fixes` will close the associated issue, and `Updates` will link the PR to it.

#### Sample commit message

```text
extensions/extenzi: Add quux functions
To implement the quux functions from #xxyyz, we need to
flottivate the crosp, then ensure that the orping is
appred.
Fixes #xxyyz
Signed-off-by: Your Name <you@youremail.com>
```

### Merging commits

Pull requests with multiple commits can be merged with the [Create a merge commit](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-request-merges) option.
Merging pull requests with multiple commits can make sense in cases where a change involves code generation or mechanical changes that can be cleanly separated from semantic changes.

Maintainers should feel free to request authors to squash their branches. Maintainers should default to this if the branch contains WIP commits.

### PR CI Actions

Before a PR is accepted it will need to pass the validation checks. Authors can find a reasonable degree of of surety that they will pass by running `make test` though this is only a subset of the checks that validation undertakes (for example, validation does an e2e test).
46 changes: 30 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ build: gen-objects gen-manifests
run: build
build/cartographer

.PHONY: gen-objects
gen-objects:
crd_non_sources := pkg/apis/v1alpha1/zz_generated.deepcopy.go $(wildcard pkg/apis/v1alpha1/*_test.go)
crd_sources := $(filter-out $(crd_non_sources),$(wildcard pkg/apis/v1alpha1/*.go))

pkg/apis/v1alpha1/zz_generated.deepcopy.go: $(crd_sources)
go run sigs.k8s.io/controller-tools/cmd/controller-gen \
object \
paths=./pkg/apis/v1alpha1

.PHONY: gen-manifests
gen-manifests:
config/crd/bases/*.yaml &: $(crd_sources)
go run sigs.k8s.io/controller-tools/cmd/controller-gen \
crd \
paths=./pkg/apis/v1alpha1 \
Expand All @@ -22,21 +23,35 @@ gen-manifests:
-f ./hack/boilerplate.go.txt \
config/crd/bases

.PHONY: test-gen-objects
test-gen-objects:
.PHONY: gen-objects
gen-objects: pkg/apis/v1alpha1/zz_generated.deepcopy.go

.PHONY: gen-manifests
gen-manifests: config/crd/bases/*.yaml

test_crd_sources := $(wildcard tests/resources/*.go)
test_object_sources := $(filter-out tests/resources/zz_generated.deepcopy.go,$(test_crd_sources))

tests/resources/zz_generated.deepcopy.go: $(test_object_sources)
go run sigs.k8s.io/controller-tools/cmd/controller-gen \
object \
paths=./tests/integration/pipeline_service/testapi
paths=./tests/resources

.PHONY: test-gen-manifests
test-gen-manifests:
.PHONY: test-gen-objects
test-gen-objects: tests/resources/zz_generated.deepcopy.go

test_crds := tests/resources/test.go
tests/resources/crds/test.run_tests.yaml: $(test_crds) tests/resources/groupversion_info.go
go run sigs.k8s.io/controller-tools/cmd/controller-gen \
crd \
paths=./tests/integration/pipeline_service/testapi \
output:crd:artifacts:config=./tests/integration/pipeline_service/testapi/crds
paths=./tests/resources \
output:crd:artifacts:config=./tests/resources/crds
go run github.com/google/addlicense \
-f ./hack/boilerplate.go.txt \
./tests/integration/pipeline_service/testapi/crds
./tests/resources/crds

.PHONY: test-gen-manifests
test-gen-manifests: tests/resources/crds/*

.PHONY: clean-fakes
clean-fakes:
Expand All @@ -47,15 +62,15 @@ generate: clean-fakes
go generate ./...

.PHONY: test-unit
test-unit:
test-unit: test-gen-objects
go run github.com/onsi/ginkgo/ginkgo -r pkg

.PHONY: test-integration
test-integration:
test-integration: test-gen-manifests test-gen-objects
go run github.com/onsi/ginkgo/ginkgo -r tests/integration

.PHONY: test-kuttl
test-kuttl: build
test-kuttl: build test-gen-manifests
if [ -n "$$focus" ]; then kubectl kuttl test --test $$(basename $(focus)); else kubectl kuttl test; fi

.PHONY: list-kuttl
Expand Down Expand Up @@ -89,7 +104,6 @@ lint: copyright
go run github.com/golangci/golangci-lint/cmd/golangci-lint --config lint-config.yaml run
$(MAKE) -C hack lint


.PHONY: copyright
copyright:
go run github.com/google/addlicense \
Expand Down
34 changes: 17 additions & 17 deletions hack/docker-login.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,37 @@ set -o pipefail
set -o nounset

readonly DOCKER_REGISTRY=${DOCKER_REGISTRY:-"https://index.docker.io/v1/"}
readonly DOCKER_CONFIG=${DOCKER_CONFIG:-"$(realpath ~/.docker/config.json)"}
readonly DOCKER_USERNAME=$DOCKER_USERNAME
readonly DOCKER_PASSWORD=$DOCKER_PASSWORD
readonly DOCKER_CONFIG=${DOCKER_CONFIG:-"$(realpath ~/.docker)"}
readonly DOCKER_USERNAME="${DOCKER_USERNAME}"
readonly DOCKER_PASSWORD="${DOCKER_PASSWORD}"

main() {
local auth=$(basic_auth $DOCKER_USERNAME $DOCKER_PASSWORD)
local auth
auth=$(basic_auth "${DOCKER_USERNAME}" "${DOCKER_PASSWORD}")

update_or_create_docker_config $DOCKER_REGISTRY $auth $DOCKER_CONFIG
mkdir -p "$DOCKER_CONFIG"
update_or_create_docker_config "${DOCKER_REGISTRY}" "$auth" "${DOCKER_CONFIG}/config.json"
}

update_or_create_docker_config() {
local server=$1
local token=$2
local config_file=$3
local server="$1"
local token="$2"
local config_file="$3"

readonly qry='.auths["%s"] = {"auth": "%s"}'
local query
query="$(printf '.auths["%s"] = {"auth": "%s"}' "$server" "$token")"

local current_content=$(jq '.' $config_file)
if [[ "$current_content" == "" ]]; then
echo '{}' >$config_file
fi
local config
config=$(echo {} | jq "$query")

config=$(jq "$(printf "$qry" $server $token)" < "$config_file")
echo "$config" > $config_file
echo "$config" > "$config_file"
}

basic_auth() {
local username=$1
local username="$1"
local password=$2

printf '%s:%s' $username $password | base64
printf '%s:%s' "$username" "$password" | base64
}

main "$@"
Loading

0 comments on commit 911639c

Please sign in to comment.