Skip to content
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

feat(default-provisioner): add mssql default provisioner support #235

Merged
merged 6 commits into from
Jan 19, 2025

Conversation

lekaf974
Copy link
Contributor

@lekaf974 lekaf974 commented Jan 9, 2025

Description

Add a defalult MSSQL provisioner

What does this PR do?

Fix #195

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • New chore (expected functionality to be implemented)

Checklist:

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • I've signed off with an email address that matches the commit author.

Local tests

# Init
~$ go run ../../cmd/score-compose/main.go init -f ./score.yaml 
INFO: Writing new state directory '.score-compose'
INFO: Writing new state directory '.score-compose' with project name '15-mssql-database'
INFO: Writing default provisioners yaml file 'zz-default.provisioners.yaml'
INFO: Found existing Score file './score.yaml'

# Generate
$ go run ../../cmd/score-compose/main.go generate score.yaml 
INFO: Loaded state directory with docker compose project '15-mssql-database'
INFO: Validated workload 'example'
INFO: Successfully loaded 13 resource provisioners
INFO: mssql.default#example.db: mssql.default#example.db: To connect to mssql: "docker run -it --network 15-mssql-database_default --rm mcr.microsoft.com/mssql/server:latest mysql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -p '*******'"
INFO: Provisioned 1 resources
INFO: Converting workload 'example' to Docker compose

@lekaf974 lekaf974 marked this pull request as ready for review January 10, 2025 01:26
@lekaf974
Copy link
Contributor Author

@mathieu-benoit ok for another reveiew

Copy link
Contributor

@mathieu-benoit mathieu-benoit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Tested with:

score-compose: init --provisioners https://raw.githubusercontent.com/lekaf974/score-compose/refs/heads/mssql-default-provisioner/internal/command/default.provisioners.yaml
score-compose generate score.yaml

And this Score file:

apiVersion: score.dev/v1b1
metadata:
  name: test-container
containers:
  main:
    image: mcr.microsoft.com/mssql-tools:latest
    variables:
      SERVER_NAME: ${resources.db.server}
      MSSQL_SA_USER: ${resources.db.username}
      MSSQL_SA_PASSWORD: ${resources.db.password}
    command:
      - /bin/sh
      - -c
      - /opt/mssql-tools/bin/sqlcmd -S $SERVER_NAME -U $MSSQL_SA_USER -P $MSSQL_SA_PASSWORD -Q "select @@version"
resources:
  db:
    type: mssql

Getting successfully:

-----
Microsoft SQL Server 2022 (RTM-CU16) (KB5048033) - 16.0.4165.4 (X64) 
        Nov  6 2024 19:24:49 
        Copyright (C) 2022 Microsoft Corporation
        Developer Edition (64-bit) on Linux (Ubuntu 22.04.5 LTS) <X64>                                                                                                      

(1 rows affected)

@astromechza, maybe a second pair of eyes on this review?

README.md Outdated Show resolved Hide resolved
@mathieu-benoit mathieu-benoit self-requested a review January 13, 2025 03:30
Signed-off-by: lekaf974 <matthieu.evrin@gmail.com>
…visioner support

Signed-off-by: lekaf974 <matthieu.evrin@gmail.com>
Signed-off-by: lekaf974 <matthieu.evrin@gmail.com>
Signed-off-by: lekaf974 <matthieu.evrin@gmail.com>
Signed-off-by: lekaf974 <matthieu.evrin@gmail.com>
…tion

Signed-off-by: lekaf974 <matthieu.evrin@gmail.com>
@lekaf974 lekaf974 force-pushed the mssql-default-provisioner branch from 7bae077 to 2f99fb4 Compare January 19, 2025 02:21
@mathieu-benoit mathieu-benoit merged commit 4ac9e65 into score-spec:main Jan 19, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature request] Add a default mssql provisioner
2 participants