-
Notifications
You must be signed in to change notification settings - Fork 0
Add integration tests and CI workflows #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
8af72f4
.github: Move lint to pre-merge workflow
TeddyAndrieux 5124d65
.github: Ensure generated go is up to date in CI
TeddyAndrieux bd82c20
internal: Remove tests for now (it will be done in integration tests)
TeddyAndrieux 31b815f
.devcontainer: Add kind and kubectl in Dockerfile
TeddyAndrieux ca09826
.github: Move test workflow to pre-merge
TeddyAndrieux 6bb54c0
.github: Move e2e-test workflow to pre-merge
TeddyAndrieux 9dcf4cb
.github: Add build of container image in pre-merge
TeddyAndrieux e4cc7a7
.github: Add post-merge workflow
TeddyAndrieux d297f6c
.github: Add promote workflow
TeddyAndrieux 20c2400
.github: Add release workflow
TeddyAndrieux 88defb7
chore: Fix bug revoked certificates not removed if the list is cleared
TeddyAndrieux 1a88a4c
test: Add integration tests for ManagedCRL secret creation
TeddyAndrieux 9ecc943
test: Add integration test for ManagedCRL with exposed pod
TeddyAndrieux ba809ca
test: Add integration tests for ManagedCRL ingress creation
TeddyAndrieux 9b0e48c
test: Add integration tests for ManagedCRL issuer configuration
TeddyAndrieux c8c50c7
.github: Disable e2e tests for now
TeddyAndrieux 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
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,62 @@ | ||
| name: "Build" | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| is-development: | ||
| description: "Whether the build is for development purposes or not" | ||
| required: false | ||
| default: true | ||
| type: boolean | ||
| is-latest: | ||
| description: "Whether the build is for the latest tag or not" | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
| is-stable: | ||
| description: "Whether the build is for a stable release or not" | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| # NOTE: We fetch depth so that we can put the right `GIT` reference | ||
| fetch-depth: 0 | ||
| ref: ${{ github.ref }} | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Login to the registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.repository_owner }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Compute tags | ||
| id: tags | ||
| # If `is-development` then suffix tag with `-dev` | ||
| # If `is-latest` then add `latest` tag | ||
| # If not `is-stable` then suffix `-dev` to `latest | ||
| run: | | ||
| version="$(git describe --tags --always --dirty --match='v[0-9]*')${{ inputs.is-development && '-dev' || '' }}" | ||
| tags="ghcr.io/${{ github.repository }}:${version}" | ||
| if [ "${{ inputs.is-latest }}" = "true" ]; then | ||
| tags="$tags,ghcr.io/${{ github.repository }}:latest${{ ! inputs.is-stable && '-dev' || '' }}" | ||
| fi | ||
| echo "tags=$tags" >> $GITHUB_OUTPUT | ||
| echo "version=$version" >> $GITHUB_OUTPUT | ||
| - name: Build image | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| build-args: | ||
| VERSION=${{ steps.tags.outputs.version }} | ||
| push: true | ||
| tags: ${{ steps.tags.outputs.tags }} | ||
| cache-from: type=gha,scope=crl-operator | ||
| cache-to: type=gha,mode=max,scope=crl-operator | ||
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,15 @@ | ||
| name: "Post Merge" | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| build: | ||
| uses: ./.github/workflows/build.yaml | ||
| secrets: inherit | ||
| with: | ||
| is-development: false | ||
| is-latest: true | ||
| is-stable: false |
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,55 @@ | ||
| name: "Pre Merge" | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| build: | ||
| uses: ./.github/workflows/build.yaml | ||
| secrets: inherit | ||
| with: | ||
| is-development: true | ||
| is-latest: false | ||
| is-stable: false | ||
|
|
||
| generate: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Setup go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: go.mod | ||
| - name: Run code generation | ||
| # We run code generation to ensure that the generated code is up to date | ||
| run: | | ||
| go generate ./... && | ||
| make generate manifests && | ||
| git diff --quiet | ||
|
vdaviot marked this conversation as resolved.
|
||
|
|
||
| lint: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Setup go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: go.mod | ||
| - name: Run linters | ||
| uses: golangci/golangci-lint-action@v8 | ||
| with: | ||
| version: v2.5.0 | ||
|
|
||
| test: | ||
| uses: ./.github/workflows/test.yml | ||
| secrets: inherit | ||
|
|
||
| test-e2e: | ||
| uses: ./.github/workflows/test-e2e.yml | ||
| secrets: inherit | ||
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,39 @@ | ||
| name: Promote | ||
| run-name: "Promote ${{ github.ref_name }}" | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v*" | ||
|
|
||
| jobs: | ||
| build: | ||
| uses: ./.github/workflows/build.yaml | ||
| secrets: inherit | ||
| with: | ||
| is-development: false | ||
| is-latest: true | ||
| is-stable: ${{ ! contains(github.ref_name, '-') }} | ||
|
|
||
| create-release: | ||
| needs: build | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| # NOTE: We explicitly set the refs otherwise the tag | ||
| # annotations content is not fetched | ||
| # See: https://github.com/actions/checkout/issues/882 | ||
| ref: ${{ github.ref }} | ||
| - uses: softprops/action-gh-release@v2 | ||
| with: | ||
| name: CRL Operator ${{ github.ref_name }} | ||
| tag_name: ${{ github.ref_name }} | ||
| generate_release_notes: true | ||
| # We consider pre-releases if the tag contains a hyphen | ||
| # e.g. v1.2.3-alpha.0 | ||
| prerelease: ${{ contains(github.ref_name, '-') }} | ||
| draft: false | ||
| 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,83 @@ | ||
| name: "Release" | ||
| run-name: Release new ${{ inputs.version-type }} from ${{ github.ref_name }} | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version-type: | ||
| description: "Version type" | ||
| required: true | ||
| type: choice | ||
| default: "alpha" | ||
| options: | ||
| - "alpha" | ||
| - "beta" | ||
| - "GA" | ||
| version-scope: | ||
| description: "Version scope" | ||
| required: true | ||
| type: choice | ||
| default: "patch" | ||
| options: | ||
| - "patch" | ||
| - "minor" | ||
| - "major" | ||
|
|
||
| jobs: | ||
| prepare-version: | ||
| runs-on: ubuntu-24.04 | ||
| if: github.ref_name == 'main' | ||
| steps: | ||
| - uses: actions/create-github-app-token@v2 | ||
| id: app-token | ||
| # NOTE: This is needed otherwise it's the same user that create the tag | ||
| # than the one triggering the workflow on push tag which does not work | ||
| with: | ||
| app-id: ${{ vars.ACTIONS_APP_ID }} | ||
| private-key: ${{ secrets.ACTIONS_APP_PRIVATE_KEY }} | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
| token: ${{ steps.app-token.outputs.token }} | ||
| - name: Install semver tool | ||
| run: | | ||
| curl --fail -LO https://raw.githubusercontent.com/fsaintjacques/semver-tool/3.4.0/src/semver | ||
| chmod +x ./semver | ||
| - name: Compose release tag | ||
| run: | | ||
| last_ga_tag="$(git tag --sort=taggerdate --list "v*" | grep -v '\-' | tail -n 1)" | ||
| if [[ -z "$last_ga_tag" ]]; then | ||
| last_ga_tag="0.0.0" | ||
| fi | ||
|
|
||
| new_version="$(./semver bump "${{ inputs.version-scope }}" "$last_ga_tag")" | ||
|
|
||
| if [[ "${{ inputs.version-type }}" == "alpha" ]] || [[ "${{ inputs.version-type }}" == "beta" ]]; then | ||
| last_pre_tag="$(git tag --sort=taggerdate --list "v$new_version-${{ inputs.version-type }}.*" | tail -n 1)" | ||
| if [[ -z "$last_pre_tag" ]]; then | ||
| new_version="$new_version-${{ inputs.version-type }}.1" | ||
| else | ||
| new_version="$(./semver bump prerel "$last_pre_tag")" | ||
| fi | ||
| fi | ||
|
|
||
| if [[ "${new_version:0:1}" != "v" ]]; then | ||
| new_version="v$new_version" | ||
| fi | ||
|
|
||
| echo "New version: $new_version" | ||
| echo "RELEASE_TAG=$new_version" >> "$GITHUB_ENV" | ||
| - name: Validate ${{ env.RELEASE_TAG }} tag | ||
| run: ./semver validate ${{ env.RELEASE_TAG }} | ||
|
|
||
| - name: Create and push `${{ env.RELEASE_TAG }}` tag | ||
| run: | | ||
| git fsck | ||
| git gc | ||
|
|
||
| git config --global user.email ${{ github.actor }}@scality.com | ||
| git config --global user.name ${{ github.actor }} | ||
|
|
||
| git tag -a "${{ env.RELEASE_TAG }}" -m "CRL Operator ${{ env.RELEASE_TAG }}" | ||
| git push origin "${{ env.RELEASE_TAG }}" |
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
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
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.
Not sure that the is belongs here
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.
Why ?
(Those workflows are the same we use in different repos already)