This repository was archived by the owner on Dec 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add conditions and release to replication controller #10
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
515734c
feat: add conditions and release to replication controller
Skarlso a8a66ff
Adding more failure conditions
Skarlso 905d08d
fix requeuing
Skarlso df83cb8
refactoring out the ocm specific details from the controller
Skarlso b21fc3c
advancing withthe test coverage
Skarlso b35e474
fix the test and the fake
Skarlso File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| name-template: '$NEXT_MINOR_VERSION' | ||
| tag-template: '$NEXT_MINOR_VERSION' | ||
| version-template: '$COMPLETE' | ||
| change-template: '- $TITLE (#$NUMBER)' | ||
| change-title-escapes: '\<*_&#@`' | ||
| template: | | ||
| # Release $NEXT_MINOR_VERSION | ||
|
|
||
| $CHANGES | ||
| exclude-labels: | ||
| - 'kind/skip-release-notes' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: Check for diff after manifest and generated targets | ||
|
|
||
| on: | ||
| pull_request: {} | ||
|
|
||
| jobs: | ||
| check: | ||
| name: Check for diff | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Make manifests && generate | ||
| run: | | ||
| make manifests && make generate | ||
| - name: Setup Go | ||
| uses: actions/setup-go@v3 | ||
| with: | ||
| go-version-file: '${{ github.workspace }}/go.mod' | ||
| - name: Restore Go cache | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: /home/runner/work/_temp/_github_home/go/pkg/mod | ||
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-go- | ||
| - name: go mod tidy | ||
| run: | | ||
| go mod tidy | ||
| - name: Check for diff | ||
| run: | | ||
| git diff --exit-code --shortstat |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| name: Release Drafter | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| permissions: | ||
| contents: read | ||
| # The release-drafter action adds PR titles to the release notes once these are merged to main. | ||
| # A draft release is kept up-to-date listing the changes for the next minor release version. | ||
| jobs: | ||
| update_release_draft: | ||
| permissions: | ||
| contents: write | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: release-drafter/release-drafter@v5 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| release_candidate: | ||
| type: boolean | ||
| description: "Release Candidate" | ||
| required: false | ||
| default: false | ||
|
|
||
| env: | ||
| REGISTRY: ghcr.io | ||
| DOCKERFILE: ${{ github.workspace }}/goreleaser.dockerfile | ||
|
|
||
| jobs: | ||
| tests: | ||
| uses: ./.github/workflows/tests.yaml | ||
| permissions: | ||
| contents: read | ||
| pull-requests: 'read' | ||
| release: | ||
| needs: tests | ||
| name: Trigger release build | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: 'write' | ||
| id-token: 'write' | ||
| pull-requests: 'read' | ||
| repository-projects: 'write' | ||
| packages: 'write' | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Setup Go | ||
| uses: actions/setup-go@v3 | ||
| with: | ||
| go-version-file: '${{ github.workspace }}/go.mod' | ||
| - name: Cache go-build and mod | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: | | ||
| ~/.cache/go-build/ | ||
| ~/go/pkg/mod/ | ||
| key: go-${{ hashFiles('go.sum') }} | ||
| restore-keys: | | ||
| go- | ||
| - name: Set release version | ||
| run: | | ||
| if ${{ inputs.release_candidate }}; then | ||
| echo "RELEASE_VERSION=$(go run $GITHUB_WORKSPACE/pkg/version/generate/release_generate.go print-rc-version)" >> $GITHUB_ENV | ||
| else | ||
| echo "RELEASE_VERSION=$(go run $GITHUB_WORKSPACE/pkg/version/generate/release_generate.go print-version)" >> $GITHUB_ENV | ||
| fi | ||
| - name: Set release notes file | ||
| run: | | ||
| echo "RELEASE_NOTES_FILE=docs/release_notes/$(go run $GITHUB_WORKSPACE/pkg/version/generate/release_generate.go print-version).md" >> $GITHUB_ENV | ||
| - name: Validate release notes | ||
| run: | | ||
| if [[ ! -f ${{ env.RELEASE_NOTES_FILE }} ]]; then | ||
| >&2 echo "Must have release notes ${{ env.RELEASE_NOTES_FILE }}" | ||
| exit 6 | ||
| fi | ||
| - name: Create and push branch | ||
| env: | ||
| RELEASE_BRANCH: release-${{ env.RELEASE_VERSION }} | ||
| run: | | ||
| if ! git checkout ${RELEASE_BRANCH} >/dev/null; then | ||
| echo "Creating ${RELEASE_BRANCH} from $(git branch --show-current)" | ||
| git checkout -b ${RELEASE_BRANCH} | ||
| git push origin "$(git branch --show-current)" | ||
| else | ||
| git checkout ${RELEASE_BRANCH} | ||
| git pull --ff-only origin ${RELEASE_BRANCH} | ||
| fi | ||
| - name: Setup git config | ||
| run: | | ||
| git config user.name "GitHub Actions Bot" | ||
| git config user.email "<41898282+github-actions[bot]@users.noreply.github.com>" | ||
| - name: Create and push tag | ||
| run: | | ||
| msg="Release ${{ env.RELEASE_VERSION }}" | ||
| git tag --annotate --message "${msg}" ${{ env.RELEASE_VERSION }} | ||
| git push origin ${{ env.RELEASE_VERSION }} | ||
| - name: Log in to the Container registry | ||
| uses: docker/login-action@v2 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Generate manifests | ||
| run: | | ||
| mkdir -p output | ||
| kustomize build ./config/default > ./output/install.yaml | ||
| - name: Run goreleaser | ||
| uses: goreleaser/goreleaser-action@v4 | ||
| with: | ||
| distribution: goreleaser | ||
| version: latest | ||
| args: release --clean --timeout 60m --skip-validate --config=./.goreleaser.yaml --release-notes=${{ env.RELEASE_NOTES_FILE }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| GORELEASER_CURRENT_TAG: ${{ env.RELEASE_VERSION }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| name: tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths-ignore: | ||
| - 'CODE_OF_CONDUCT.md' | ||
| - 'README.md' | ||
| - 'Contributing.md' | ||
| workflow_call: | ||
|
|
||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| permissions: | ||
| contents: read # for actions/checkout to fetch code | ||
|
|
||
| jobs: | ||
| test-linux: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
| - name: Setup Go | ||
| uses: actions/setup-go@v3 | ||
| with: | ||
| go-version-file: '${{ github.workspace }}/go.mod' | ||
| - name: Restore Go cache | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: /home/runner/work/_temp/_github_home/go/pkg/mod | ||
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-go- | ||
| - name: Run tests | ||
| run: make test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # This is an example .goreleaser.yml file with some sensible defaults. | ||
| # Make sure to check the documentation at https://goreleaser.com | ||
| before: | ||
| hooks: | ||
| - go mod tidy | ||
| builds: | ||
| - main: main.go | ||
| env: | ||
| - CGO_ENABLED=0 | ||
| goos: | ||
| - linux | ||
| - darwin | ||
| goarch: | ||
| - amd64 | ||
| archives: | ||
| - name_template: >- | ||
| {{ .ProjectName }}_ | ||
| {{- title .Os }}_ | ||
| {{- if eq .Arch "amd64" }}x86_64 | ||
| {{- else if eq .Arch "386" }}i386 | ||
| {{- else }}{{ .Arch }}{{ end }} | ||
| release: | ||
| extra_files: | ||
| - glob: output/install.yaml | ||
| checksum: | ||
| name_template: 'checksums.txt' | ||
| extra_files: | ||
| - glob: output/install.yaml | ||
| snapshot: | ||
| name_template: "{{ incpatch .Version }}-next" | ||
| changelog: | ||
| sort: asc | ||
| filters: | ||
| exclude: | ||
| - '^docs:' | ||
| - '^test:' | ||
| # for more information on what this target does: https://goreleaser.com/errors/docker-build/ | ||
| dockers: | ||
| - id: linux-build | ||
| image_templates: | ||
| - "{{ .Env.REGISTRY }}/open-component-model/{{ .ProjectName }}:{{ .Tag }}" | ||
| - "{{ .Env.REGISTRY }}/open-component-model/{{ .ProjectName }}:latest" | ||
| # GOOS of the built binary that should be used. | ||
| goos: linux | ||
| # GOARCH of the built binary that should be used. | ||
| goarch: amd64 | ||
| dockerfile: "{{ .Env.DOCKERFILE }}" | ||
| build_flag_templates: | ||
| - "--platform=linux/amd64" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 👍🏻