-
Notifications
You must be signed in to change notification settings - Fork 0
feat: bootstrap the meshStack CLI and move the API client in #1
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
Draft
grubmeshi
wants to merge
204
commits into
main
Choose a base branch
from
feat/scaffold-cli-and-move-client
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
204 commits
Select commit
Hold shift + click to select a range
0796486
refactor: move client to separate package
henryde a0baddf
feat: project group bindings
henryde aa3165b
feat: building block resource
henryde 0947438
fix: updated status codes
henryde 7cdf4b7
fix: contentType for project user binding
malhussan af11b1d
fix: Set Accept header when getting a Building Block
sttomm 4b23a7e
fix: http response code for building block creation is now 201
henryde f9c7a9e
fix: response codes for project and tenant creation
henryde 4d96b33
feat: add basic implementation of tag_definitions data source
JohannesRudolph 656d18b
feat: meshstack_tag_definition data source (GET)
malhussan 28c9595
feat: meshstack_tag_definition resource
malhussan 94e7d03
feat: set metadata.name automatically for tag_definition
henryde 76f7c6c
refactor: check success by 2xx range
uleMeshcloud ba64475
feature: preview building blocks v2 resources
henryde e6df98a
feature: source provider configuration from environment
henryde b3b3f9a
fix: allow code inputs in buildingblock resource
malhussan 2dc6030
feat: workspace data source
henryde 6118432
feat: workspace resource
henryde ef46955
feat: meshstack_tenant_v4 resource
malhussan d71487c
fix: adapt tenant v4 client to actual implementation
henryde d919793
fix: adapt tenant_v4 resource to actual implementation
henryde 9ac4d63
feat: buildingblock v2 polling for completion
malhussan 0802352
feat: tenant v4 polling for completion
malhussan c67b1c9
chore: example for building_block_v2
malhussan 3d2ffc9
add initial workspace bindings
OliverEsoterik 36d7b91
additional changes from project to workspace, remove duplicates
OliverEsoterik 0c6813b
duplicates and rrs resolved
OliverEsoterik 5eb5713
remove typo in workspace group bindings
OliverEsoterik 7f0a4f8
fmt
OliverEsoterik e36aba5
refactor: buildingblock status constants
malhussan 54180a8
Merge pull request #44 from OliverEsoterik/workspace-bindings
j0g3sc d950611
refactor: move type out of loop
henryde a46ce61
fix: use pointers for optional tag value fields
henryde 15dcd28
fix: add missing replicationKey to tag definition
henryde ac3b80b
chore: format all code according to go-fmt
nroi f8e67de
chore: fix typo in workspace.go (paylod)
nroi f4482d0
feat: support meshLandingZones
nroi 4782eb0
chore: fix capitalization: AWS -> Aws etc.
nroi 409ebff
fix: add missing landing zone status
nroi b6c1a50
chore: remove redundant MeshLandingZoneCreateMetadata
nroi e918df6
fix: fix landing zone status
nroi 0244cf4
feat: implement support for meshPlatforms
nroi d3fa716
fix: make landingzone info_link optional
nroi 746f2c3
chore: use new API endpoint for login and improve error message in ca…
j0g3sc 1ee35ca
feat: add quota definitions to meshPlatforms
j0g3sc 5460edf
feat: add metering config to platform
henryde 8945872
feature: metering config for aks platforms
henryde 1bf8944
refactor: separate platform configs by platform
henryde 470415d
fix: correctly model nullable platform config fields
henryde 0b7d8f8
refactor: common data structure for tenant tags
henryde eb66164
fix: small issues
henryde 60a7c11
chore: generate docs
henryde 88cfb6c
refactor: AksServicePrincipal
henryde 0b00147
feat: added payment method resource and data endpoint
younGihan a59ffa1
Update client/payment_method.go
younGihan 485b1fc
feat: removed workspace identifier for URL creation as not required
younGihan 9928220
feat: quotas in landing zone data source
henryde deed5e7
Merge pull request #74 from meshcloud/feature/adding-payment-method
younGihan a7a35d7
feat: multi select building block inputs
henryde cd9785b
feat: integrations client
henryde 4225ddc
feat: integrations data source
henryde ba0a686
fix: upstream api changed secret handling
henryde a2c08fd
fix: many golangci-lint issues, remove unused lookUpEndpoints in client
grubmeshi 497bda6
feat: add meshstack_location resource
grubmeshi 44caff0
feat: add metadata.owned_by_workspace for landing zones
nroi 87903c1
fix: building block refs required by landing zones
henryde 135bf96
refactor: read and return body already in doAuthenticatedRequest, ver…
grubmeshi 5eebb12
refactor: use generate unmarshalBody(IfPresent)
grubmeshi 8128350
refactor: use request modifiers and build http.Request only in doAuth…
grubmeshi 63a8c50
refactor: remove deleteMeshObject and overeager status code validatio…
grubmeshi 10f6f88
refactor: simplify client for workspace/project binding
grubmeshi 41f210e
fix: provide (versioning) Accept header when calling DELETE endpoints
grubmeshi 6bfabe8
refactor: simplify fetching paginated responses, add simplistic data …
grubmeshi b9fdd6f
refactor: use generic meshObjectClient to build MeshStackProviderClie…
grubmeshi bff3a79
refactor: simplify httpClient methods and url query handling
grubmeshi 3c6c847
feat: change user agent such that the provider version is included
grubmeshi 788b5d1
refactor: clean up client.NewClient() with factory methods and reflec…
grubmeshi 69482ca
refactor: move MeshObjectClient into client/internal
grubmeshi 88c6d71
refactor: use sub-clients in resources/data sources and helper config…
grubmeshi c30d092
feat: use gci to consistently format imports, improve Taskfile args h…
grubmeshi 86cdac2
feat: properly implement logging using tflog from SDK, remove version…
grubmeshi 276e69a
refactor: add util.PollAtMostFor(...).Until instead of cluttering up …
grubmeshi 5188e2d
refactor: rename resource/datasource struct client fields (resolves r…
grubmeshi 234279b
feat: platform type data sources and resource
henryde 1eb24de
feat: add status field to platform type
henryde c073f53
fix: upstream structure has changed
henryde 0b94a1b
feat: login via api token
henryde cd5eafa
feat: check meshStack version
henryde 0f1e056
feat: add client/version package for parsing meshStack version
grubmeshi afc3e89
fix: use client/version
grubmeshi 8752fc2
fix: subscription creation error cooldown nullable
henryde 9f43b5e
feat: add `owned_by_workspace` for platform_type
nroi 2595875
feat: custom platforms in meshstack_platform
henryde ae81c68
feat: service instance client
henryde 745f0b9
feat: add support for `custom` landing zone
nroi 03e67dc
refactor: rename name to better term 'kind' in internal.MeshObjectClient
grubmeshi cb8d596
refactor: move Secret DTO from platform to commonly shared client/typ…
grubmeshi d034bcb
feat: add ptr.To helper in client/types/ptr
grubmeshi 758df6c
feat: support defining Go enum strings
grubmeshi 1fd17bc
feat: add Variant[X, Y] in client/types/variant
grubmeshi 90c3f91
feat: add mock client and resource test for meshstack_tag_definition
grubmeshi e61f057
feat: add mock client and resource/datasource test for meshstack_plat…
grubmeshi bac587f
feat: add mock client and extend resource test for meshstack_location
grubmeshi ad78a3e
feat: add mock client and resource/datasource test for meshstack_plat…
grubmeshi 4f99ecf
feat: implement meshstack_integration resource with mock client
grubmeshi 5ed8ad7
feat: use default runner in meshstack_integration if omitted, add ref…
grubmeshi 8c37628
feat: add client.BuildingBlockDefinition(version) with model
grubmeshi f62ac8b
feat: add meshstack_building_block_definition
grubmeshi 0dc1f1a
fix: handle empty argument/defaultValue correctly in SecretOrAny
grubmeshi 91d1926
feat: add permissions to meshstack_building_block_definition.version_…
grubmeshi 25726ac
fix: missing/wrong azure config fields
henryde 92797c7
feat: add parameter support to ServiceInstance resource
sttomm 79b2afd
fix: make BBD notification_subscribers a set and handle removal of in…
grubmeshi 3edb184
feat: add `owned_by_workspace` for meshstack_location
nroi 09bfce5
feat: make meshPlatform related resources GA
sttomm cb7aa23
refactor: remove apiVersion and kind from platform related terraform …
sttomm 415725f
feat: support write-only ephemeral secrets in meshstack_platform reso…
grubmeshi 7b0b057
refactor: rename to StringSetElem
grubmeshi a54b425
fix: properly handle null/empty in BBD, simplify set handling in gene…
grubmeshi 76f4f65
feat: add pre_run_script field to meshstack_building_block_definition…
JohannesRudolph 65c842a
fix: address review comments and CI failures for pre_run_script field
Copilot 35e74a5
feat: Add aws_identity_store support to meshstack_platform resource
Copilot c6d8961
fix: use existing role refs and remove wrong mst- prefix docs
JohannesRudolph 807b3b2
fix: only support the actually valid output IO types
sttomm 73b7ccb
fix: fix platform config boolean flags for AWS and AzureRG (#139)
grubmeshi 0c4bd12
refactor: remove api_version/kind, extract client interfaces
grubmeshi 2094fae
feat: add meshstack_tenants data source
grubmeshi 0301314
feat: expose platform access_information in resource and data source
grubmeshi 88732b6
feat: add refName property to AzureDevOps Building Block Definition i…
sttomm 536cadd
refactor: use Go 1.26 new(expression) feature
grubmeshi dbece1a
feat: Removes Azure Blueprint and OpenShift template support
tfelix c6cbc5a
feat: add meshstack_api_key resource
grubmeshi a684374
test: add cross-workspace BBD listing test
grubmeshi afbfed3
refactor: use Authoriztion.Header abstraction, improve error message
grubmeshi 02a757c
feat: retry GET/PUT requests and POST login and add internal.HttpClie…
grubmeshi 91c85f4
feat: adapt building_block_v2 to moved createdOn field in upstream API
nroi 135a43b
fix: adapt building block definition after changes in upstream API
nroi 686a3bc
fix: do not expose lifecycle in BB schema (resource/datasource)
grubmeshi c9fcd89
fix: add lifecycle state tracking to building_block_v2
nroi 23b2ddc
chore: document all lifecycle states for building_block_v2
nroi dddf8ff
chore: add test for BB deletion
nroi dfc7983
fix: migrate building block target references
nroi abd332c
feat: introduce MESHSTACK_SKIP_VERSION_CHECK to skip version check
nroi 58adb1b
fix: change input/output structure from array to map
nroi 34926e5
feat: add meshstack_building_block_runner resource
malhussan 92bffda
fix: revert "change input/output structure from array to map"
nroi 4d82399
fix: change input/output structure from array to map
nroi 9ac5638
feat: add purge_on_delete support to meshstack_building_block_v2
grubmeshi 24bc91c
fix: align BB v2 client with embedded-secret sensitive inputs
grubmeshi 359aaab
feat: add ALL capability to building block runner implementation types
tfelix 0e53c9f
chore: bump to v0.22.0 release, require newest meshstack
grubmeshi fa000ba
feat: allow MANAGED_BUILDINGBLOCK_SAVE on building block permissions
grubmeshi 745865e
feat: add support for EntraId meshIntegrations
j0g3sc 5d89105
refactor: generic DoRequest/DoAuthorizedRequest http client API
grubmeshi 4481ff5
refactor: normalize buildingblock → building_block file & symbol names
grubmeshi cd3a815
feat: implement meshstack_building_block resource
grubmeshi ed533bf
feat: meshstack_building_blocks data source
grubmeshi 66d8a17
fix: retry DELETE and widen retry budget for backend restarts
grubmeshi b244bac
fix: prepare for upcoming WAITING_FOR_APPROVAL building block status
sttomm 1c138e6
feat: allow to manage display_order value for building block definiti…
j0g3sc 37932cf
fix(building_block_definition): send display_order 0 so it round-trips
grubmeshi 3fda00f
fix(building_block): tolerate transient FAILED during a force-purge d…
grubmeshi 2eff7cf
feat: add meshTenant UUID as BB input assignmentType
j0g3sc 38137db
refactor: rename MESH_TENANT_UUID to MESHSTACK_TENANT_ID
j0g3sc f7313c9
refactor: rename MESHSTACK_TENANT_ID assignment type to MESHSTACK_TEN…
grubmeshi 868021d
feat: allow all dedicated (not NONE) assignment types for outputs on …
j0g3sc fb1aa92
refactor: consolidate meshObject reference handling behind a single m…
grubmeshi 05780df
refactor: consolidate client ref DTOs into shared NamedRef/UuidRef
grubmeshi 71d0aa0
refactor: model platform aws/gcp role mappings as sets
grubmeshi 8464031
feat: back meshstack_tenant and meshstack_tenants with the meshTenant…
grubmeshi 3cd7346
fix: source meshstack_tenant status from the v4 tenantName field
grubmeshi c045ae8
fix: track only user-declared tags on taggable resources
tfelix 74b5fa9
feat: send building block definition dependencies as dependencyDefini…
grubmeshi f95cf67
refactor: derive List query params from struct json tags in WithUrlQuery
grubmeshi 66fe815
fix: make declared outputs work on manual building blocks
vzaslavsky 958d448
feat!: rename meshstack_tenant status.tenant_identifier to tenant_name
grubmeshi dc0621d
chore: apply go1.26 go fix idioms
grubmeshi 2999fae
feat: add List wrappers to platform and landing zone clients
grubmeshi ee819a2
feat: add meshstack_platforms and meshstack_landingzones data sources
grubmeshi 6a10431
feat: expiry date on workspace bindings
vzaslavsky a6d35b7
feat: read back effective tenant quotas from meshTenant v4 status.quotas
tfelix 6ae439d
feat: model tenant quotas as maps (requested_quotas / applied_quotas)
tfelix acd3c49
feat: model tenant quotas as structured value objects and warn on unr…
tfelix 8807963
fix: correct tenant quota approval semantics, cover landing-zone defa…
tfelix 82ae669
chore: fix acceptance tests timeouts at tenant deletion
j0g3sc 7d06765
feat!: reference parent building blocks by ref, and add the building …
grubmeshi e44839a
feat!: remove the deprecated spec.quotas from meshstack_tenant
grubmeshi 6a54f75
feat!: promote meshstack_tenant to the meshTenant v4 GA API
grubmeshi b605a9d
feat: bootstrap the meshStack CLI repository
grubmeshi 6b4fee9
fix: honor MESHSTACK_SKIP_VERSION_CHECK before requesting /mesh/info
JohannesRudolph cc1894e
fix: tolerate unknown spec values and ref-shaped meshTenant v4 reads
grubmeshi 2cd35d4
Merge origin/main into the v0.24.5 fix branch
grubmeshi 5a27467
feat: manage a landing zone's restricted flag via spec.restricted
nroi 7eb1881
refactor: model landing zone spec.restricted as a plain bool
nroi b732181
feat: add meshStack instance data source
j0g3sc dd03c54
refactor: address review comments regarding mesh_info struct and client
j0g3sc 7ff0696
refactor: expose meshstack_instance four-eyes state as enabled_featur…
j0g3sc 2d757f7
fix: put CHANGELOG entry to new version as 0.24.4 is released already.
j0g3sc c16cc98
Add client/ from terraform-provider-meshstack via git subtree
grubmeshi e8a03cf
refactor: point the moved client at the meshstack-cli module path
grubmeshi 2320592
feat: add pkg/login, the shared credential resolution
grubmeshi 0454c95
feat: release with goreleaser and publish a container image
grubmeshi 163b976
docs: record that client/ is a git subtree and how to sync it
grubmeshi 0b77443
fix: make CI's lint formatting deterministic, and stop filtering to c…
grubmeshi 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 @@ | ||
| # The build only needs the Go sources, go.mod and go.sum. Everything below would | ||
| # otherwise be copied into the build context and invalidate its cache. | ||
| .git/ | ||
| .github/ | ||
| dist/ | ||
| .nix-go/ | ||
| meshstack | ||
| .env | ||
| .vscode/ | ||
| .idea/ | ||
| *.md |
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,84 @@ | ||
| # Builds the meshstack container image and pushes it to GHCR only. Modelled on | ||
| # meshcloud/building-block-runner's build-images.yml, minus the Docker Hub push. | ||
| name: Build Image | ||
|
|
||
| env: | ||
| REGISTRY: ghcr.io | ||
| IMAGE_NAMESPACE: ${{ github.repository_owner }} | ||
| IMAGE_NAME: meshstack-cli | ||
|
|
||
| on: | ||
| # Called by the release workflow, so a tagged release publishes the matching image. | ||
| workflow_call: | ||
| inputs: | ||
| version: | ||
| description: "Release version to tag the image with, e.g. v1.2.3" | ||
| required: true | ||
| type: string | ||
| # A push to main refreshes :main, which is what makes the image usable before the | ||
| # first release exists. | ||
| push: | ||
| branches: | ||
| - main | ||
| # Pull requests build the image but do not push it, so a broken Dockerfile fails | ||
| # review rather than main. | ||
| pull_request: | ||
| paths: | ||
| - 'Dockerfile' | ||
| - '.github/workflows/build-image.yml' | ||
| - 'go.mod' | ||
| - 'go.sum' | ||
| - '**/*.go' | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build and push image | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
|
|
||
| # Tags are computed here rather than with docker/metadata-action, to keep the | ||
| # set of pinned actions small. | ||
| - name: Determine version and tags | ||
| id: meta | ||
| run: | | ||
| if [ -n "${{ inputs.version }}" ]; then | ||
| version="${{ inputs.version }}" | ||
| tags="${REGISTRY}/${IMAGE_NAMESPACE}/${IMAGE_NAME}:${version}" | ||
| tags="${tags},${REGISTRY}/${IMAGE_NAMESPACE}/${IMAGE_NAME}:latest" | ||
| elif [ "${{ github.ref }}" = "refs/heads/main" ]; then | ||
| version="main-$(git rev-parse --short HEAD)" | ||
| tags="${REGISTRY}/${IMAGE_NAMESPACE}/${IMAGE_NAME}:main" | ||
| tags="${tags},${REGISTRY}/${IMAGE_NAMESPACE}/${IMAGE_NAME}:${version}" | ||
| else | ||
| version="pr-${{ github.event.number }}" | ||
| tags="${REGISTRY}/${IMAGE_NAMESPACE}/${IMAGE_NAME}:${version}" | ||
| fi | ||
| echo "version=${version}" >> "$GITHUB_OUTPUT" | ||
| echo "tags=${tags}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 | ||
|
|
||
| - name: Login to GHCR | ||
| if: github.event_name != 'pull_request' | ||
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Build and push | ||
| uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 | ||
| with: | ||
| context: . | ||
| platforms: linux/amd64,linux/arm64 | ||
| push: ${{ github.event_name != 'pull_request' }} | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| build-args: | | ||
| VERSION=${{ steps.meta.outputs.version }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max |
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,46 @@ | ||
| # Releases the meshstack CLI when a tag matching "v*" is pushed. | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| goreleaser: | ||
| name: GoReleaser | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| # Creating a release and uploading its assets counts as writing contents. | ||
| contents: write | ||
| steps: | ||
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| # Let goreleaser read older tags, which it needs for the changelog. | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | ||
| with: | ||
| go-version-file: 'go.mod' | ||
| cache: true | ||
| - name: Run GoReleaser | ||
| uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3 | ||
| with: | ||
| args: release --clean | ||
| env: | ||
| # GitHub sets GITHUB_TOKEN automatically. | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| # Publishes the image for the same tag. Separate job so a failing image build does | ||
| # not take the archives down with it. | ||
| image: | ||
| name: Image | ||
| needs: [ goreleaser ] | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| uses: ./.github/workflows/build-image.yml | ||
| with: | ||
| version: ${{ github.ref_name }} |
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 @@ | ||
| # meshStack CLI build, lint and test workflow. | ||
| name: Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths-ignore: | ||
| - 'README.md' | ||
| push: | ||
| branches: | ||
| - main | ||
| paths-ignore: | ||
| - 'README.md' | ||
|
|
||
| # Testing only needs permissions to read the repository contents. | ||
| permissions: | ||
| contents: read | ||
|
|
||
| # Cancel superseded runs on the same ref. | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Go Build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | ||
| with: | ||
| go-version-file: 'go.mod' | ||
| cache: true | ||
| - run: go mod tidy | ||
| - run: go build -v ./... | ||
| - name: git diff | ||
| run: | | ||
| git diff --compact-summary --exit-code || \ | ||
| (echo; echo "Unexpected difference in directories after 'go mod tidy'. Run 'go mod tidy' command and commit."; exit 1) | ||
|
|
||
| golangci: | ||
| needs: [ build ] | ||
| name: Go Lint and Format Check | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | ||
| with: | ||
| # The repository's pinned Go, because it is what builds the linter below. | ||
| go-version-file: 'go.mod' | ||
| - name: golangci-lint | ||
| uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0 | ||
| with: | ||
| # golangci-lint's formatters use the go/format compiled into the binary, so the | ||
| # formatting they enforce comes from the Go release that BUILT the linter, not | ||
| # from the toolchain on PATH. The published binaries are built with whatever Go | ||
| # was current at release time, which made 'version: latest' with install-mode | ||
| # 'binary' enforce a different gofmt than the pinned Go: 1.27 widens end-of-line | ||
| # comment alignment groups, and 1.26 rejects the result, so the two disagree with | ||
| # no formatting that satisfies both. Building the linter here with go.mod's Go | ||
| # ties formatting to the version the code is written against. | ||
| install-mode: goinstall | ||
| version: v2.13.0 | ||
| # Deliberately no only-new-issues: this repository starts clean and CI keeps it | ||
| # that way, so filtering to changed code cannot help and can only hide a finding. | ||
| # It hid this one, and still hides it in the provider's identical job. | ||
| - name: Suggest fix command on failure | ||
| if: failure() | ||
| run: | | ||
| echo "::error::Linting or formatting issues detected. Run 'task lint -- --fix' locally to automatically fix these issues, then commit the changes." | ||
|
|
||
| test: | ||
| needs: [ build ] | ||
| name: Go Test | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | ||
| with: | ||
| go-version-file: 'go.mod' | ||
| cache: true | ||
| - run: go test -v ./... |
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 @@ | ||
| # Binary produced by 'task build' | ||
| /meshstack | ||
|
|
||
| # Release artifacts produced by goreleaser | ||
| /dist/ | ||
|
|
||
| # Go environment created by the Nix dev shell (flake.nix shellHook) | ||
| /.nix-go/ | ||
|
|
||
| # Local meshStack credentials, read by the Taskfile's dotenv | ||
| .env | ||
|
|
||
| # Editor and IDE directories | ||
| .vscode/ | ||
| .idea/ | ||
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,106 @@ | ||
| # Visit https://golangci-lint.run/ for usage documentation | ||
| # and information on other useful linters. | ||
| # | ||
| # Kept deliberately close to the meshStack Terraform provider's configuration, so | ||
| # that code moving between the two repositories does not trip a different linter set. | ||
| version: "2" | ||
| issues: | ||
| max-same-issues: 0 | ||
|
|
||
| formatters: | ||
| enable: | ||
| - gci | ||
| - gofmt | ||
| settings: | ||
| gci: | ||
| sections: | ||
| - standard # Go standard library | ||
| - default # All other external dependencies | ||
| - localmodule # This repository's modules | ||
|
|
||
| linters: | ||
| default: none | ||
| enable: | ||
| - depguard | ||
| - durationcheck | ||
| - errcheck | ||
| - copyloopvar | ||
| - forcetypeassert | ||
| - godot | ||
| - ineffassign | ||
| - makezero | ||
| - misspell | ||
| - nilerr | ||
| - predeclared | ||
| - staticcheck | ||
| - usetesting | ||
| - unconvert | ||
| - unparam | ||
| - unused | ||
| - govet | ||
| - testifylint | ||
| - thelper | ||
| settings: | ||
| # This repository is allowed exactly one external dependency, cobra, and only the | ||
| # cmd/ tree may use it. Everything else stays on the standard library, with testify | ||
| # permitted in tests. The rules below are what enforces that; read them as the | ||
| # dependency policy rather than as lint configuration. | ||
| depguard: | ||
| rules: | ||
| # client/ must stay free of external dependencies. The meshStack Terraform | ||
| # provider consumes this package, so anything added here lands in the | ||
| # provider's dependency tree as well. | ||
| client: | ||
| files: | ||
| # Both patterns are needed: '**/dir/**/*.go' only matches files in | ||
| # subdirectories of dir, never files directly inside it. | ||
| - "**/client/*.go" | ||
| - "**/client/**/*.go" | ||
| - "!$test" | ||
| list-mode: strict | ||
| allow: | ||
| - $gostd | ||
| - github.com/meshcloud/meshstack-cli/client | ||
|
|
||
| # pkg/ holds logic reusable outside a CLI process — the Terraform provider | ||
| # imports pkg/login — so cobra must not reach it. | ||
| pkg: | ||
| files: | ||
| - "**/pkg/*.go" | ||
| - "**/pkg/**/*.go" | ||
| - "!$test" | ||
| list-mode: strict | ||
| deny: | ||
| - pkg: github.com/spf13/cobra | ||
| desc: cobra belongs in cmd/; pkg/ is also consumed by the Terraform provider | ||
| allow: | ||
| - $gostd | ||
| - github.com/meshcloud/meshstack-cli/client | ||
| - github.com/meshcloud/meshstack-cli/pkg | ||
|
|
||
| # cmd/ builds the command tree, and is the only place cobra is used. | ||
| cmd: | ||
| files: | ||
| - "**/cmd/*.go" | ||
| - "**/cmd/**/*.go" | ||
| - "!$test" | ||
| list-mode: strict | ||
| deny: | ||
| - pkg: log # as $gostd is allowed | ||
| desc: Write user-facing output through the command's own streams | ||
| allow: | ||
| - $gostd | ||
| - github.com/meshcloud/meshstack-cli | ||
| - github.com/spf13/cobra | ||
|
|
||
| # Tests may additionally use testify, which is what the client's moved tests | ||
| # are written against. | ||
| tests: | ||
| files: | ||
| - "$test" | ||
| list-mode: strict | ||
| allow: | ||
| - $gostd | ||
| - github.com/meshcloud/meshstack-cli | ||
| - github.com/spf13/cobra | ||
| - github.com/stretchr/testify |
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.
Uh oh!
There was an error while loading. Please reload this page.