Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
212 commits
Select commit Hold shift + click to select a range
0796486
refactor: move client to separate package
henryde Jun 19, 2024
a0baddf
feat: project group bindings
henryde Jun 21, 2024
aa3165b
feat: building block resource
henryde Jun 28, 2024
0947438
fix: updated status codes
henryde Jul 4, 2024
7cdf4b7
fix: contentType for project user binding
malhussan Jul 9, 2024
af11b1d
fix: Set Accept header when getting a Building Block
sttomm Aug 2, 2024
4b23a7e
fix: http response code for building block creation is now 201
henryde Nov 14, 2024
f9c7a9e
fix: response codes for project and tenant creation
henryde Nov 15, 2024
4d96b33
feat: add basic implementation of tag_definitions data source
JohannesRudolph Nov 4, 2024
656d18b
feat: meshstack_tag_definition data source (GET)
malhussan Nov 5, 2024
28c9595
feat: meshstack_tag_definition resource
malhussan Nov 6, 2024
94e7d03
feat: set metadata.name automatically for tag_definition
henryde Nov 12, 2024
76f7c6c
refactor: check success by 2xx range
uleMeshcloud Dec 10, 2024
ba64475
feature: preview building blocks v2 resources
henryde Feb 25, 2025
e6df98a
feature: source provider configuration from environment
henryde Apr 17, 2025
b3b3f9a
fix: allow code inputs in buildingblock resource
malhussan Jul 31, 2025
2dc6030
feat: workspace data source
henryde Jul 23, 2025
6118432
feat: workspace resource
henryde Jul 23, 2025
ef46955
feat: meshstack_tenant_v4 resource
malhussan Nov 7, 2024
d71487c
fix: adapt tenant v4 client to actual implementation
henryde Jul 28, 2025
d919793
fix: adapt tenant_v4 resource to actual implementation
henryde Jul 28, 2025
9ac4d63
feat: buildingblock v2 polling for completion
malhussan Aug 11, 2025
0802352
feat: tenant v4 polling for completion
malhussan Aug 13, 2025
c67b1c9
chore: example for building_block_v2
malhussan Aug 14, 2025
3d2ffc9
add initial workspace bindings
OliverEsoterik Aug 18, 2025
36d7b91
additional changes from project to workspace, remove duplicates
OliverEsoterik Aug 18, 2025
0c6813b
duplicates and rrs resolved
OliverEsoterik Aug 18, 2025
5eb5713
remove typo in workspace group bindings
OliverEsoterik Aug 18, 2025
7f0a4f8
fmt
OliverEsoterik Aug 18, 2025
e36aba5
refactor: buildingblock status constants
malhussan Aug 18, 2025
54180a8
Merge pull request #44 from OliverEsoterik/workspace-bindings
j0g3sc Aug 25, 2025
d950611
refactor: move type out of loop
henryde Aug 29, 2025
a46ce61
fix: use pointers for optional tag value fields
henryde Aug 29, 2025
15dcd28
fix: add missing replicationKey to tag definition
henryde Aug 29, 2025
ac3b80b
chore: format all code according to go-fmt
nroi Sep 18, 2025
f8e67de
chore: fix typo in workspace.go (paylod)
nroi Sep 18, 2025
f4482d0
feat: support meshLandingZones
nroi Sep 10, 2025
4782eb0
chore: fix capitalization: AWS -> Aws etc.
nroi Sep 19, 2025
409ebff
fix: add missing landing zone status
nroi Sep 19, 2025
b6c1a50
chore: remove redundant MeshLandingZoneCreateMetadata
nroi Sep 19, 2025
e918df6
fix: fix landing zone status
nroi Sep 19, 2025
0244cf4
feat: implement support for meshPlatforms
nroi Sep 23, 2025
d3fa716
fix: make landingzone info_link optional
nroi Oct 20, 2025
746f2c3
chore: use new API endpoint for login and improve error message in ca…
j0g3sc Nov 3, 2025
1ee35ca
feat: add quota definitions to meshPlatforms
j0g3sc Nov 6, 2025
5460edf
feat: add metering config to platform
henryde Nov 12, 2025
8945872
feature: metering config for aks platforms
henryde Nov 13, 2025
1bf8944
refactor: separate platform configs by platform
henryde Nov 13, 2025
470415d
fix: correctly model nullable platform config fields
henryde Nov 13, 2025
0b7d8f8
refactor: common data structure for tenant tags
henryde Nov 13, 2025
eb66164
fix: small issues
henryde Nov 13, 2025
60a7c11
chore: generate docs
henryde Nov 17, 2025
88cfb6c
refactor: AksServicePrincipal
henryde Nov 17, 2025
0b00147
feat: added payment method resource and data endpoint
younGihan Nov 19, 2025
a59ffa1
Update client/payment_method.go
younGihan Nov 19, 2025
485b1fc
feat: removed workspace identifier for URL creation as not required
younGihan Nov 19, 2025
9928220
feat: quotas in landing zone data source
henryde Nov 19, 2025
deed5e7
Merge pull request #74 from meshcloud/feature/adding-payment-method
younGihan Nov 24, 2025
a7a35d7
feat: multi select building block inputs
henryde Nov 25, 2025
cd9785b
feat: integrations client
henryde Dec 5, 2025
4225ddc
feat: integrations data source
henryde Dec 11, 2025
ba0a686
fix: upstream api changed secret handling
henryde Dec 8, 2025
a2c08fd
fix: many golangci-lint issues, remove unused lookUpEndpoints in client
grubmeshi Dec 19, 2025
497bda6
feat: add meshstack_location resource
grubmeshi Dec 18, 2025
44caff0
feat: add metadata.owned_by_workspace for landing zones
nroi Jan 7, 2026
87903c1
fix: building block refs required by landing zones
henryde Jan 14, 2026
135bf96
refactor: read and return body already in doAuthenticatedRequest, ver…
grubmeshi Jan 9, 2026
5eebb12
refactor: use generate unmarshalBody(IfPresent)
grubmeshi Jan 9, 2026
8128350
refactor: use request modifiers and build http.Request only in doAuth…
grubmeshi Jan 9, 2026
63a8c50
refactor: remove deleteMeshObject and overeager status code validatio…
grubmeshi Jan 9, 2026
10f6f88
refactor: simplify client for workspace/project binding
grubmeshi Jan 9, 2026
41f210e
fix: provide (versioning) Accept header when calling DELETE endpoints
grubmeshi Jan 9, 2026
6bfabe8
refactor: simplify fetching paginated responses, add simplistic data …
grubmeshi Jan 9, 2026
b9fdd6f
refactor: use generic meshObjectClient to build MeshStackProviderClie…
grubmeshi Jan 9, 2026
bff3a79
refactor: simplify httpClient methods and url query handling
grubmeshi Jan 9, 2026
3c6c847
feat: change user agent such that the provider version is included
grubmeshi Jan 9, 2026
788b5d1
refactor: clean up client.NewClient() with factory methods and reflec…
grubmeshi Jan 9, 2026
69482ca
refactor: move MeshObjectClient into client/internal
grubmeshi Jan 10, 2026
88c6d71
refactor: use sub-clients in resources/data sources and helper config…
grubmeshi Jan 10, 2026
c30d092
feat: use gci to consistently format imports, improve Taskfile args h…
grubmeshi Jan 12, 2026
86cdac2
feat: properly implement logging using tflog from SDK, remove version…
grubmeshi Jan 12, 2026
276e69a
refactor: add util.PollAtMostFor(...).Until instead of cluttering up …
grubmeshi Jan 12, 2026
5188e2d
refactor: rename resource/datasource struct client fields (resolves r…
grubmeshi Jan 13, 2026
234279b
feat: platform type data sources and resource
henryde Jan 16, 2026
1eb24de
feat: add status field to platform type
henryde Jan 20, 2026
c073f53
fix: upstream structure has changed
henryde Jan 21, 2026
0b94a1b
feat: login via api token
henryde Jan 19, 2026
cd5eafa
feat: check meshStack version
henryde Jan 21, 2026
0f1e056
feat: add client/version package for parsing meshStack version
grubmeshi Jan 23, 2026
afc3e89
fix: use client/version
grubmeshi Jan 23, 2026
8752fc2
fix: subscription creation error cooldown nullable
henryde Jan 28, 2026
9f43b5e
feat: add `owned_by_workspace` for platform_type
nroi Jan 26, 2026
2595875
feat: custom platforms in meshstack_platform
henryde Feb 4, 2026
ae81c68
feat: service instance client
henryde Feb 6, 2026
745f0b9
feat: add support for `custom` landing zone
nroi Feb 12, 2026
03e67dc
refactor: rename name to better term 'kind' in internal.MeshObjectClient
grubmeshi Jan 15, 2026
cb8d596
refactor: move Secret DTO from platform to commonly shared client/typ…
grubmeshi Jan 21, 2026
d034bcb
feat: add ptr.To helper in client/types/ptr
grubmeshi Jan 21, 2026
758df6c
feat: support defining Go enum strings
grubmeshi Jan 30, 2026
1fd17bc
feat: add Variant[X, Y] in client/types/variant
grubmeshi Jan 30, 2026
90c3f91
feat: add mock client and resource test for meshstack_tag_definition
grubmeshi Feb 4, 2026
e61f057
feat: add mock client and resource/datasource test for meshstack_plat…
grubmeshi Feb 4, 2026
bac587f
feat: add mock client and extend resource test for meshstack_location
grubmeshi Feb 4, 2026
ad78a3e
feat: add mock client and resource/datasource test for meshstack_plat…
grubmeshi Feb 4, 2026
4f99ecf
feat: implement meshstack_integration resource with mock client
grubmeshi Feb 5, 2026
5ed8ad7
feat: use default runner in meshstack_integration if omitted, add ref…
grubmeshi Feb 8, 2026
8c37628
feat: add client.BuildingBlockDefinition(version) with model
grubmeshi Jan 10, 2026
f62ac8b
feat: add meshstack_building_block_definition
grubmeshi Feb 11, 2026
0dc1f1a
fix: handle empty argument/defaultValue correctly in SecretOrAny
grubmeshi Feb 11, 2026
91d1926
feat: add permissions to meshstack_building_block_definition.version_…
grubmeshi Feb 13, 2026
25726ac
fix: missing/wrong azure config fields
henryde Feb 17, 2026
92797c7
feat: add parameter support to ServiceInstance resource
sttomm Feb 17, 2026
79b2afd
fix: make BBD notification_subscribers a set and handle removal of in…
grubmeshi Feb 17, 2026
3edb184
feat: add `owned_by_workspace` for meshstack_location
nroi Feb 17, 2026
09bfce5
feat: make meshPlatform related resources GA
sttomm Feb 16, 2026
cb7aa23
refactor: remove apiVersion and kind from platform related terraform …
sttomm Feb 18, 2026
415725f
feat: support write-only ephemeral secrets in meshstack_platform reso…
grubmeshi Feb 18, 2026
7b0b057
refactor: rename to StringSetElem
grubmeshi Feb 19, 2026
a54b425
fix: properly handle null/empty in BBD, simplify set handling in gene…
grubmeshi Feb 24, 2026
76f4f65
feat: add pre_run_script field to meshstack_building_block_definition…
JohannesRudolph Mar 9, 2026
65c842a
fix: address review comments and CI failures for pre_run_script field
Copilot Mar 11, 2026
35e74a5
feat: Add aws_identity_store support to meshstack_platform resource
Copilot Mar 11, 2026
c6d8961
fix: use existing role refs and remove wrong mst- prefix docs
JohannesRudolph Mar 12, 2026
807b3b2
fix: only support the actually valid output IO types
sttomm Mar 18, 2026
73b7ccb
fix: fix platform config boolean flags for AWS and AzureRG (#139)
grubmeshi Apr 1, 2026
0c4bd12
refactor: remove api_version/kind, extract client interfaces
grubmeshi Apr 9, 2026
2094fae
feat: add meshstack_tenants data source
grubmeshi Apr 9, 2026
0301314
feat: expose platform access_information in resource and data source
grubmeshi Apr 14, 2026
88732b6
feat: add refName property to AzureDevOps Building Block Definition i…
sttomm Apr 2, 2026
536cadd
refactor: use Go 1.26 new(expression) feature
grubmeshi Apr 23, 2026
dbece1a
feat: Removes Azure Blueprint and OpenShift template support
tfelix May 4, 2026
c6cbc5a
feat: add meshstack_api_key resource
grubmeshi Apr 29, 2026
a684374
test: add cross-workspace BBD listing test
grubmeshi May 5, 2026
afbfed3
refactor: use Authoriztion.Header abstraction, improve error message
grubmeshi May 8, 2026
02a757c
feat: retry GET/PUT requests and POST login and add internal.HttpClie…
grubmeshi May 8, 2026
91c85f4
feat: adapt building_block_v2 to moved createdOn field in upstream API
nroi May 6, 2026
135a43b
fix: adapt building block definition after changes in upstream API
nroi May 7, 2026
686a3bc
fix: do not expose lifecycle in BB schema (resource/datasource)
grubmeshi May 12, 2026
c9fcd89
fix: add lifecycle state tracking to building_block_v2
nroi May 18, 2026
23b2ddc
chore: document all lifecycle states for building_block_v2
nroi May 18, 2026
dddf8ff
chore: add test for BB deletion
nroi May 19, 2026
dfc7983
fix: migrate building block target references
nroi May 15, 2026
abd332c
feat: introduce MESHSTACK_SKIP_VERSION_CHECK to skip version check
nroi May 21, 2026
58adb1b
fix: change input/output structure from array to map
nroi May 28, 2026
34926e5
feat: add meshstack_building_block_runner resource
malhussan May 26, 2026
92bffda
fix: revert "change input/output structure from array to map"
nroi May 29, 2026
4d82399
fix: change input/output structure from array to map
nroi May 28, 2026
9ac5638
feat: add purge_on_delete support to meshstack_building_block_v2
grubmeshi Jun 2, 2026
24bc91c
fix: align BB v2 client with embedded-secret sensitive inputs
grubmeshi Jun 2, 2026
359aaab
feat: add ALL capability to building block runner implementation types
tfelix Jun 3, 2026
0e53c9f
chore: bump to v0.22.0 release, require newest meshstack
grubmeshi Jun 10, 2026
fa000ba
feat: allow MANAGED_BUILDINGBLOCK_SAVE on building block permissions
grubmeshi Jun 16, 2026
745865e
feat: add support for EntraId meshIntegrations
j0g3sc Jun 15, 2026
5d89105
refactor: generic DoRequest/DoAuthorizedRequest http client API
grubmeshi Jun 1, 2026
4481ff5
refactor: normalize buildingblock → building_block file & symbol names
grubmeshi Jun 1, 2026
cd3a815
feat: implement meshstack_building_block resource
grubmeshi Jun 1, 2026
ed533bf
feat: meshstack_building_blocks data source
grubmeshi Jun 25, 2026
66d8a17
fix: retry DELETE and widen retry budget for backend restarts
grubmeshi Jul 6, 2026
b244bac
fix: prepare for upcoming WAITING_FOR_APPROVAL building block status
sttomm Jul 7, 2026
1c138e6
feat: allow to manage display_order value for building block definiti…
j0g3sc Jul 3, 2026
37932cf
fix(building_block_definition): send display_order 0 so it round-trips
grubmeshi Jul 9, 2026
3fda00f
fix(building_block): tolerate transient FAILED during a force-purge d…
grubmeshi Jul 14, 2026
2eff7cf
feat: add meshTenant UUID as BB input assignmentType
j0g3sc Jul 16, 2026
38137db
refactor: rename MESH_TENANT_UUID to MESHSTACK_TENANT_ID
j0g3sc Jul 16, 2026
f7313c9
refactor: rename MESHSTACK_TENANT_ID assignment type to MESHSTACK_TEN…
grubmeshi Jul 17, 2026
868021d
feat: allow all dedicated (not NONE) assignment types for outputs on …
j0g3sc Jul 20, 2026
fb1aa92
refactor: consolidate meshObject reference handling behind a single m…
grubmeshi Jul 16, 2026
05780df
refactor: consolidate client ref DTOs into shared NamedRef/UuidRef
grubmeshi Jul 17, 2026
71d0aa0
refactor: model platform aws/gcp role mappings as sets
grubmeshi Jul 17, 2026
8464031
feat: back meshstack_tenant and meshstack_tenants with the meshTenant…
grubmeshi Jul 20, 2026
3cd7346
fix: source meshstack_tenant status from the v4 tenantName field
grubmeshi Jul 22, 2026
c045ae8
fix: track only user-declared tags on taggable resources
tfelix Jul 22, 2026
74b5fa9
feat: send building block definition dependencies as dependencyDefini…
grubmeshi Jul 21, 2026
f95cf67
refactor: derive List query params from struct json tags in WithUrlQuery
grubmeshi Jul 22, 2026
66fe815
fix: make declared outputs work on manual building blocks
vzaslavsky Jul 21, 2026
958d448
feat!: rename meshstack_tenant status.tenant_identifier to tenant_name
grubmeshi Jul 23, 2026
dc0621d
chore: apply go1.26 go fix idioms
grubmeshi Jul 23, 2026
2999fae
feat: add List wrappers to platform and landing zone clients
grubmeshi Jul 20, 2026
ee819a2
feat: add meshstack_platforms and meshstack_landingzones data sources
grubmeshi Jul 20, 2026
6a10431
feat: expiry date on workspace bindings
vzaslavsky Jul 23, 2026
a6d35b7
feat: read back effective tenant quotas from meshTenant v4 status.quotas
tfelix Jul 22, 2026
6ae439d
feat: model tenant quotas as maps (requested_quotas / applied_quotas)
tfelix Jul 23, 2026
acd3c49
feat: model tenant quotas as structured value objects and warn on unr…
tfelix Jul 24, 2026
8807963
fix: correct tenant quota approval semantics, cover landing-zone defa…
tfelix Jul 29, 2026
82ae669
chore: fix acceptance tests timeouts at tenant deletion
j0g3sc Jul 30, 2026
7d06765
feat!: reference parent building blocks by ref, and add the building …
grubmeshi Aug 11, 2026
e44839a
feat!: remove the deprecated spec.quotas from meshstack_tenant
grubmeshi Aug 10, 2026
6a54f75
feat!: promote meshstack_tenant to the meshTenant v4 GA API
grubmeshi Aug 12, 2026
6b4fee9
fix: honor MESHSTACK_SKIP_VERSION_CHECK before requesting /mesh/info
JohannesRudolph Aug 18, 2026
cc1894e
fix: tolerate unknown spec values and ref-shaped meshTenant v4 reads
grubmeshi Aug 19, 2026
2cd35d4
Merge origin/main into the v0.24.5 fix branch
grubmeshi Aug 19, 2026
5a27467
feat: manage a landing zone's restricted flag via spec.restricted
nroi Aug 13, 2026
7eb1881
refactor: model landing zone spec.restricted as a plain bool
nroi Aug 14, 2026
b732181
feat: add meshStack instance data source
j0g3sc Aug 13, 2026
dd03c54
refactor: address review comments regarding mesh_info struct and client
j0g3sc Aug 13, 2026
7ff0696
refactor: expose meshstack_instance four-eyes state as enabled_featur…
j0g3sc Aug 13, 2026
2d757f7
fix: put CHANGELOG entry to new version as 0.24.4 is released already.
j0g3sc Aug 13, 2026
2302b71
feat: support adopting an existing identity provider on entra id inte…
malhussan Aug 24, 2026
350ef89
fix!: move the entra id redirect url to status
malhussan Aug 24, 2026
1d49c39
feat: add an optional building block name template
grubmeshi Aug 25, 2026
7601c58
feat: expose building block definition approvals and drift schedule
nroi Aug 31, 2026
6fb6fa8
feat: read a meshStack tag as a building block definition input
tfelix Sep 1, 2026
b188bbb
feat: support optional Building Block Definition inputs
j0g3sc Aug 20, 2026
fb71cad
build: move to go 1.27 and pin golangci-lint as a go tool
grubmeshi Sep 2, 2026
a242aa1
feat: support JSON_SCHEMA building block definition inputs
tfelix Aug 27, 2026
6954a55
refactor: derive definition input types from the IO types
tfelix Sep 1, 2026
ce90235
docs: describe JSON_SCHEMA inputs as the sub-form they are
tfelix Sep 1, 2026
fe5bd16
feat: support conditional inputs
j0g3sc Sep 8, 2026
cf78ea1
refactor: rename the JSON_SCHEMA definition input type to JSON
tfelix Sep 8, 2026
a69f73a
feat: move the meshStack API client into this repository
grubmeshi Sep 9, 2026
8c5854f
refactor: build the moved client against this module
grubmeshi Sep 9, 2026
394e45e
feat: add the meshstack command line interface
grubmeshi Sep 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "jq -r '.tool_input.file_path // empty' | { read -r f; [[ \"$f\" == *.go ]] && cd \"$CLAUDE_PROJECT_DIR\" && go tool golangci-lint fmt \"$f\"; } 2>/dev/null || true"
}
]
}
]
}
}
11 changes: 11 additions & 0 deletions .dockerignore
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
84 changes: 84 additions & 0 deletions .github/workflows/build-image.yml
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
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
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 }}
229 changes: 229 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1 +1,230 @@
# 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
- forbidigo
- forcetypeassert
- godot
- ineffassign
- makezero
- misspell
- nilerr
- predeclared
- staticcheck
- usetesting
- unconvert
- unparam
- unused
- govet
- testifylint
- thelper

exclusions:
rules:
# A test that stands up an httptest.Server and points a client at it makes no request
# the shipped binary makes, so the rule below has nothing to say about it.
- path: _test\.go
linters:
- forbidigo

# The one package that may build a client, which is the whole point of the rule.
- path: internal/http/
linters:
- forbidigo

settings:
# One HTTP client for the process, built in internal/http, and nothing else may make an
# outbound request of its own. There used to be three: pkg/auth posted to /api/login
# through http.DefaultClient, which has no timeout at all; pkg/oidc kept one with a
# 30-second one; and the API client built a third with five minutes. Only the last of them
# retried, so which policy a request got depended on which package happened to make it.
#
# It sits at the module root rather than under client/ because Go's internal rule would
# otherwise close it to pkg/oidc and pkg/auth, and inside the module's internal tree
# because the Terraform provider must not be able to configure it.
#
# This is forbidigo rather than a depguard deny because depguard bans an import path and
# net/http is one package for three unrelated things. Denying it would also deny
# http.StatusOK and http.MethodPost, which every caller reading a response needs, and the
# http.Server that pkg/oidc/browser runs for the loopback redirect — a server, not a
# second client. Naming the identifiers keeps all of that legal.
forbidigo:
# Match on the type rather than on the written name. It is what makes `pkg` below work,
# and it is what this rule needs, because internal/http's own type is also called Client
# and is imported under the name http. Without it, every legitimate use would be a
# finding and every net/http one behind an alias would not.
analyze-types: true
forbid:
- pattern: \.(Client|DefaultClient|Transport|DefaultTransport|Get|Head|Post|PostForm)$
pkg: ^net/http$
msg: the process has one HTTP client, built in internal/http; take it from there rather than making another

# These rules are the dependency policy, not an enforcement of one written down
# elsewhere, so widening one is a decision rather than a lint fix. The lists below
# are exhaustive by intent: two external dependencies, cobra and charmbracelet/log,
# each confined to a smaller area than the module.
#
# The reason to keep it that tight is outside this repository. The meshStack
# Terraform provider imports client/ and pkg/auth, so every dependency reachable
# from those packages lands in the provider's dependency tree, and from there in
# the public checksum database.
depguard:
rules:
# The package the Terraform provider consumes most directly.
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
# The HTTP machinery client/ is built on. It moved out of client/internal so that
# pkg/oidc and pkg/auth could reach it too, which is why the meshObject clients
# import it from the module root now.
- github.com/meshcloud/meshstack-cli/internal/http
# The setting mechanism, for MESHSTACK_SKIP_VERSION_CHECK.
- github.com/meshcloud/meshstack-cli/internal/setting

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
- pkg: github.com/meshcloud/meshstack-cli/pkg/oidc/browser
desc: only cmd/ and internal/cli may open a browser; the Terraform provider links pkg/auth and must not be able to reach the browser flow
allow:
- $gostd
- github.com/meshcloud/meshstack-cli/client
- github.com/meshcloud/meshstack-cli/pkg
# The process's one HTTP client. pkg/auth and pkg/oidc each address a different
# host — meshStack and the identity provider — and both go through it.
- github.com/meshcloud/meshstack-cli/internal/http
# The setting mechanism. pkg/setting is the narrower view the Terraform provider
# gets: a source it may supply, and a declaration it may read.
- github.com/meshcloud/meshstack-cli/internal/setting

# internal/http is the process's one HTTP client, and it needs nothing but the standard
# library to be one. It sits outside client/ because Go's internal rule would otherwise
# close it to pkg/, and inside the module's internal tree because the Terraform provider
# must not be able to configure it.
internal-http:
files:
- "**/internal/http/*.go"
- "!$test"
list-mode: strict
allow:
- $gostd

# internal/cli implements the CLI's half of auth.Input: flags, stdin, a terminal
# prompt and the browser login. Go's internal rule already keeps it out of the
# Terraform provider, which is what makes it the one place outside cmd/ that may
# reach pkg/oidc/browser. The pkg rule above cannot reach these files — its
# files: list names **/pkg/ — so the deny there does not apply to them.
internal-cli:
files:
- "**/internal/cli/*.go"
- "!$test"
list-mode: strict
allow:
- $gostd
- github.com/meshcloud/meshstack-cli

# cmd/ builds the command tree, and is the only place cobra is used.
cmd:
files:
- "**/cmd/*.go"
- "**/cmd/**/*.go"
# Excluding cmd/meshstack is what lets the next rule grant more than this
# one does. A file matching two rules has to satisfy both, so overlapping
# rules intersect and never widen.
- "!**/cmd/meshstack/*.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
- log/slog # a longer prefix than the deny above, so it outranks it
- github.com/meshcloud/meshstack-cli
- github.com/spf13/cobra

# The one package that configures a logger, and therefore the only one that may
# name a logging implementation. Everywhere else logs through log/slog against
# the handler installed here.
cmd-meshstack:
files:
- "**/cmd/meshstack/*.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
- log/slog
- github.com/meshcloud/meshstack-cli
- github.com/spf13/cobra
- github.com/charmbracelet/log

# acceptance/ drives the built binary against a live local meshStack, as a
# subprocess. It is deny-by-default like everything else, and it needs less than
# most: os/exec and net/http out of the standard library, testify, and client/ for
# the one struct it shares with the code under test — it decodes /mesh/info into
# client.MeshInfo, so the suite fails when that type and the backend disagree.
#
# It deliberately may not reach pkg/ or internal/. A test that called the CLI's own
# resolution to work out where its profile went would pass whenever that resolution
# was consistently wrong; asserting on the files and the exit status is the whole
# point of running the binary rather than a cobra command in-process.
acceptance:
files:
- "**/acceptance/*.go"
list-mode: strict
allow:
- $gostd
- github.com/meshcloud/meshstack-cli/client
- github.com/stretchr/testify

# 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
Loading