Skip to content

Commit 2104dff

Browse files
authored
fix/dockerbuild 1 9 (#2272)
* fix build * add missing files * chore: bump version
1 parent 58e60e7 commit 2104dff

File tree

10 files changed

+312
-3
lines changed

10 files changed

+312
-3
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Statesman dockerfile verify
3+
4+
"on":
5+
push:
6+
branches: ['develop']
7+
pull_request:
8+
9+
jobs:
10+
build:
11+
name: Build
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Download Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version: 1.24.0
19+
id: go
20+
21+
- name: Check out code into the Go module directory
22+
uses: actions/checkout@v4
23+
24+
- name: Test that the docker image still builds successfully
25+
run: |
26+
export COMMIT_SHA=$(git rev-parse --short HEAD)
27+
docker build -t testingbuild:latest --build-arg COMMIT_SHA=${COMMIT_SHA} . -f Dockerfile_statesman
28+
working-directory: taco

taco/cmd/statesman/main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/labstack/echo/v4/middleware"
1818
)
1919

20+
// change this random number to bump version of statesman: 429
2021
func main() {
2122
var (
2223
port = flag.String("port", "8080", "Server port")
@@ -54,11 +55,11 @@ func main() {
5455

5556
// Initialize analytics with system ID management (always create system ID)
5657
analytics.InitGlobalWithSystemID("production", store)
57-
58+
5859
// Initialize system ID synchronously during startup
5960
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
6061
defer cancel()
61-
62+
6263
// Try to preload existing system ID and user email first
6364
if err := analytics.PreloadSystemID(ctx); err == nil {
6465
log.Printf("System ID and user email loaded from storage")
@@ -70,7 +71,7 @@ func main() {
7071
log.Printf("System ID not available: %v", err)
7172
}
7273
}
73-
analytics.SendEssential("service_startup")
74+
analytics.SendEssential("service_startup")
7475

7576
// Create Echo instance
7677
e := echo.New()
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package tfe
2+
3+
type FeatureEntitlements struct {
4+
ID string `jsonapi:"primary,entitlement-sets"`
5+
6+
// Access and Security
7+
SSO bool `jsonapi:"attr,sso" json:"sso"`
8+
Teams bool `jsonapi:"attr,teams" json:"teams"`
9+
AuditLogging bool `jsonapi:"attr,audit-logging" json:"audit_logging"`
10+
11+
// Infrastructure & Operations
12+
Agents bool `jsonapi:"attr,agents" json:"agents"`
13+
Operations bool `jsonapi:"attr,operations" json:"operations"`
14+
StateStorage bool `jsonapi:"attr,state-storage" json:"state_storage"`
15+
16+
// Policy & Governance
17+
Sentinel bool `jsonapi:"attr,sentinel" json:"sentinel"`
18+
19+
// Modules, Integrations & Cost
20+
PrivateModuleRegistry bool `jsonapi:"attr,private-module-registry" json:"private_module_registry"`
21+
VCSIntegrations bool `jsonapi:"attr,vcs-integrations" json:"vcs_integrations"`
22+
CostEstimation bool `jsonapi:"attr,cost-estimation" json:"cost_estimation"`
23+
}
24+
25+
func DefaultFeatureEntitlements(orgId string) *FeatureEntitlements {
26+
return &FeatureEntitlements{
27+
ID: orgId,
28+
SSO: true,
29+
Teams: true,
30+
AuditLogging: true,
31+
Agents: true,
32+
Operations: true,
33+
StateStorage: true,
34+
Sentinel: true,
35+
PrivateModuleRegistry: true,
36+
VCSIntegrations: true,
37+
CostEstimation: true,
38+
}
39+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package tfe
2+
3+
import "fmt"
4+
5+
type ResourceType string
6+
7+
func (e ResourceType) String() string {
8+
return string(e)
9+
}
10+
11+
const (
12+
OrganizationType ResourceType = "org"
13+
WorkspaceType ResourceType = "ws"
14+
AgentPoolType ResourceType = "apool"
15+
)
16+
17+
type TfeResourceIdentifier struct {
18+
resourceType ResourceType
19+
id string
20+
}
21+
22+
func (id TfeResourceIdentifier) String() string {
23+
return fmt.Sprintf("%v-%v", id.resourceType, id.id)
24+
}
25+
26+
func NewTfeResourceIdentifier(resourceType ResourceType, id string) TfeResourceIdentifier {
27+
return TfeResourceIdentifier{
28+
resourceType: resourceType,
29+
id: id,
30+
}
31+
}

taco/internal/domain/tfe/login.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package tfe
2+
3+
type LoginSpec struct {
4+
Client string `json:"client"`
5+
GrantTypes []string `json:"grant_types"`
6+
Authz string `json:"authz"`
7+
Token string `json:"token"`
8+
Ports []int `json:"ports"`
9+
}
10+
11+
type WellKnownSpec struct {
12+
Login LoginSpec `json:"login.v1"`
13+
Modules string `json:"modules.v1"`
14+
MessageOfTheDay string `json:"motd.v1"`
15+
State string `json:"state.v2"`
16+
TfeApiV2 string `json:"tfe.v2"`
17+
TfeApiV21 string `json:"tfe.v2.1"`
18+
TfeApiV22 string `json:"tfe.v2.2"`
19+
}

taco/internal/domain/tfe/motd.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package tfe
2+
3+
type MotdResponse struct {
4+
Msg string `json:"msg"`
5+
}
6+
7+
func MotdMessage() string {
8+
// Use the bracketed tags like Terraform’s MOTD uses.
9+
// Terminals/clients that understand them can render colors/bold.
10+
// Keep \n (not newlines in a raw string) to match the JSON you showed.
11+
return "" +
12+
" [cyan]- [reset]\n" +
13+
" [cyan]----- -[reset]\n" +
14+
" [cyan]--------- --[reset]\n" +
15+
" [cyan]--------- - -----[reset]\n" +
16+
" [cyan]--------- ------ -------[reset]\n" +
17+
" [cyan]------- --------- ----------[reset]\n" +
18+
" [cyan]---- ---------- ----------[reset]\n" +
19+
" [cyan]-- ---------- ----------[reset]\n" +
20+
" [bold]Welcome to OpenTaco![reset] [cyan]- ---------- -------[reset]\n" +
21+
" [cyan]--- ----- ---[reset]\n" +
22+
" [bold]Documentation:[reset] opentaco.dev/docs [cyan]-------- -[reset]\n" +
23+
" [cyan]----------[reset]\n" +
24+
" [cyan]----------[reset]\n" +
25+
" [cyan]---------[reset]\n" +
26+
" [cyan]-----[reset]\n" +
27+
" [cyan]-[reset]\n" +
28+
"\n\n" +
29+
" [bold]New to OpenTaco?[reset] Try these steps to spin up quickly:\n" +
30+
"\n" +
31+
" $ Visit digger.dev/opentaco\n" +
32+
" [bold]Need help?[reset] Join: https://bit.ly/diggercommunity\n"
33+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package tfe
2+
3+
import "time"
4+
5+
// OrgAccessMatrix enumerates organization-scoped capability flags.
6+
type OrgAccessMatrix struct {
7+
CanCreateTeam bool `json:"can-create-team"`
8+
CanCreateWorkspace bool `json:"can-create-workspace"`
9+
CanCreateWorkspaceMigration bool `json:"can-create-workspace-migration"`
10+
CanDestroy bool `json:"can-destroy"`
11+
CanTraverse bool `json:"can-traverse"`
12+
CanUpdate bool `json:"can-update"`
13+
CanUpdateAPIToken bool `json:"can-update-api-token"`
14+
CanUpdateOAuth bool `json:"can-update-oauth"`
15+
CanUpdateSentinel bool `json:"can-update-sentinel"`
16+
}
17+
18+
type TFEOrganizationPermissions = OrgAccessMatrix
19+
20+
// OrgResource models an organization entity for a JSON:API client.
21+
type OrgResource struct {
22+
// Resource identifier (JSON:API primary)
23+
Name string `jsonapi:"primary,organizations"`
24+
25+
// Organization attributes
26+
AssessmentsEnforced bool `jsonapi:"attr,assessments-enforced" json:"assessments-enforced"`
27+
CollaboratorAuthPolicy string `jsonapi:"attr,collaborator-auth-policy" json:"collaborator-auth-policy"`
28+
CostEstimationEnabled bool `jsonapi:"attr,cost-estimation-enabled" json:"cost-estimation-enabled"`
29+
CreatedAt time.Time `jsonapi:"attr,created-at" json:"created-at"`
30+
Email string `jsonapi:"attr,email" json:"email"`
31+
ExternalID string `jsonapi:"attr,external-id" json:"external-id"`
32+
OwnersTeamSAMLRoleID string `jsonapi:"attr,owners-team-saml-role-id" json:"owners-team-saml-role-id"`
33+
Permissions *TFEOrganizationPermissions `jsonapi:"attr,permissions" json:"permissions"`
34+
SAMLEnabled bool `jsonapi:"attr,saml-enabled" json:"saml-enabled"`
35+
SessionRemember *int `jsonapi:"attr,session-remember" json:"session-remember"`
36+
SessionTimeout *int `jsonapi:"attr,session-timeout" json:"session-timeout"`
37+
TrialExpiresAt time.Time `jsonapi:"attr,trial-expires-at" json:"trial-expires-at"`
38+
TwoFactorConformant bool `jsonapi:"attr,two-factor-conformant" json:"two-factor-conformant"`
39+
SendPassingStatusesForUntriggeredSpeculativePlans bool `jsonapi:"attr,send-passing-statuses-for-untriggered-speculative-plans" json:"send-passing-statuses-for-untriggered-speculative-plans"`
40+
RemainingTestableCount int `jsonapi:"attr,remaining-testable-count" json:"remaining-testable-count"`
41+
42+
// For older TFE builds (prior to 202211), this flag may be absent; deletions default to forced.
43+
AllowForceDeleteWorkspaces bool `jsonapi:"attr,allow-force-delete-workspaces" json:"allow-force-delete-workspaces"`
44+
}
45+
46+
type TFEOrganization = OrgResource

taco/internal/domain/tfe/run.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package tfe
2+
3+
type TFERun struct {
4+
ID string `jsonapi:"primary,runs"`
5+
}

taco/internal/domain/tfe/vcs.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package tfe
2+
3+
type VCSRepo struct {
4+
owner string `json:"owner"`
5+
name string `json:"name"`
6+
}
7+
8+
// RepoBinding models a workspace's linkage to a VCS repository.
9+
// JSON tags are preserved for wire compatibility; symbol names are fresh.
10+
type RepoBinding struct {
11+
Branch string `json:"branch"`
12+
DisplayIdentifier string `json:"display-identifier"`
13+
Identifier VCSRepo `json:"identifier"`
14+
IngressSubmodules bool `json:"ingress-submodules"`
15+
OAuthTokenID string `json:"oauth-token-id"`
16+
RepositoryHTTPURL string `json:"repository-http-url"`
17+
TagsRegex string `json:"tags-regex"`
18+
ServiceProvider string `json:"service-provider"`
19+
}
20+
21+
type TFEVCSRepository = RepoBinding
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
package tfe
2+
3+
import "time"
4+
5+
type WorkspaceVersion struct {
6+
Latest bool `json:"latest"`
7+
semver string `json:"semver"`
8+
}
9+
10+
type TFEWorkspaceActions struct {
11+
IsDestroyable bool `json:"is-destroyable"`
12+
}
13+
14+
type WorkspaceAccessMatrix struct {
15+
CanDestroy bool `json:"can-destroy"`
16+
CanForceUnlock bool `json:"can-force-unlock"`
17+
CanLock bool `json:"can-lock"`
18+
CanQueueApply bool `json:"can-queue-apply"`
19+
CanQueueDestroy bool `json:"can-queue-destroy"`
20+
CanQueueRun bool `json:"can-queue-run"`
21+
CanReadSettings bool `json:"can-read-settings"`
22+
CanUnlock bool `json:"can-unlock"`
23+
CanUpdate bool `json:"can-update"`
24+
CanUpdateVariable bool `json:"can-update-variable"`
25+
}
26+
27+
type TFEWorkspacePermissions = WorkspaceAccessMatrix
28+
29+
// WorkspaceOutputRecord models an output resource attached to a workspace.
30+
// Field names and tags are preserved to avoid any external breaking changes.
31+
type WorkspaceOutputRecord struct {
32+
ID string `jsonapi:"primary,workspace-outputs"`
33+
Name string `jsonapi:"attr,Name" json:"Name"`
34+
Sensitive bool `jsonapi:"attr,sensitive" json:"sensitive"`
35+
Type string `jsonapi:"attr,output-type" json:"output-type"`
36+
Value any `jsonapi:"attr,value" json:"value"`
37+
}
38+
39+
// Back-compat alias so existing references to TFEWorkspaceOutput continue to compile.
40+
type TFEWorkspaceOutput = WorkspaceOutputRecord
41+
42+
// WorkspaceRecord models a workspace entity for a JSON:API client.
43+
type WorkspaceRecord struct {
44+
ID string `jsonapi:"primary,workspaces"`
45+
Actions *TFEWorkspaceActions `jsonapi:"attr,actions" json:"actions"`
46+
AgentPoolID string `jsonapi:"attr,agent-pool-id" json:"agent-pool-id"`
47+
AllowDestroyPlan bool `jsonapi:"attr,allow-destroy-plan" json:"allow-destroy-plan"`
48+
AutoApply bool `jsonapi:"attr,auto-apply" json:"auto-apply"`
49+
CanQueueDestroyPlan bool `jsonapi:"attr,can-queue-destroy-plan" json:"can-queue-destroy-plan"`
50+
CreatedAt time.Time `jsonapi:"attr,created-at" json:"created-at"`
51+
Description string `jsonapi:"attr,description" json:"description"`
52+
Environment string `jsonapi:"attr,environment" json:"environment"`
53+
ExecutionMode string `jsonapi:"attr,execution-mode" json:"execution-mode"`
54+
FileTriggersEnabled bool `jsonapi:"attr,file-triggers-enabled" json:"file-triggers-enabled"`
55+
GlobalRemoteState bool `jsonapi:"attr,global-remote-state" json:"global-remote-state"`
56+
Locked bool `jsonapi:"attr,locked" json:"locked"`
57+
MigrationEnvironment string `jsonapi:"attr,migration-environment" json:"migration-environment"`
58+
Name string `jsonapi:"attr,Name" json:"Name"`
59+
Operations bool `jsonapi:"attr,operations" json:"operations"`
60+
Permissions *TFEWorkspacePermissions `jsonapi:"attr,permissions" json:"permissions"`
61+
QueueAllRuns bool `jsonapi:"attr,queue-all-runs" json:"queue-all-runs"`
62+
SpeculativeEnabled bool `jsonapi:"attr,speculative-enabled" json:"speculative-enabled"`
63+
SourceName string `jsonapi:"attr,source-Name" json:"source-Name"`
64+
SourceURL string `jsonapi:"attr,source-url" json:"source-url"`
65+
StructuredRunOutputEnabled bool `jsonapi:"attr,structured-run-output-enabled" json:"structured-run-output-enabled"`
66+
TerraformVersion *WorkspaceVersion `jsonapi:"attr,terraform-version" json:"terraform-version"`
67+
TriggerPrefixes []string `jsonapi:"attr,trigger-prefixes" json:"trigger-prefixes"`
68+
TriggerPatterns []string `jsonapi:"attr,trigger-patterns" json:"trigger-patterns"`
69+
VCSRepo *TFEVCSRepository `jsonapi:"attr,vcs-repo" json:"vcs-repo"`
70+
WorkingDirectory string `jsonapi:"attr,working-directory" json:"working-directory"`
71+
UpdatedAt time.Time `jsonapi:"attr,updated-at" json:"updated-at"`
72+
ResourceCount int `jsonapi:"attr,resource-count" json:"resource-count"`
73+
ApplyDurationAverage time.Duration `jsonapi:"attr,apply-duration-average" json:"apply-duration-average"`
74+
PlanDurationAverage time.Duration `jsonapi:"attr,plan-duration-average" json:"plan-duration-average"`
75+
PolicyCheckFailures int `jsonapi:"attr,policy-check-failures" json:"policy-check-failures"`
76+
RunFailures int `jsonapi:"attr,run-failures" json:"run-failures"`
77+
RunsCount int `jsonapi:"attr,workspace-kpis-runs-count" json:"workspace-kpis-runs-count"`
78+
TagNames []string `jsonapi:"attr,tag-names" json:"tag-names"`
79+
80+
// Relationships
81+
CurrentRun *TFERun `jsonapi:"relation,current-run" json:"current-run"`
82+
Organization *TFEOrganization `jsonapi:"relation,organization" json:"organization"`
83+
Outputs []*TFEWorkspaceOutput `jsonapi:"relation,outputs" json:"outputs"`
84+
}
85+
86+
type TFEWorkspace = WorkspaceRecord

0 commit comments

Comments
 (0)