Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bobgroup-mage
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bob Public Utils
bobgroup-mage
Commits
2c4fe935
Commit
2c4fe935
authored
Oct 1, 2021
by
Johan de Klerk
Browse files
Options
Downloads
Plain Diff
Merge branch 'main' of gitlab.com:uafrica/mage
parents
554258e5
2b3fd4cf
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
build.go
+5
-5
5 additions, 5 deletions
build.go
cdk.go
+10
-10
10 additions, 10 deletions
cdk.go
debug.go
+4
-4
4 additions, 4 deletions
debug.go
s3.go
+2
-2
2 additions, 2 deletions
s3.go
with
21 additions
and
21 deletions
build.go
+
5
−
5
View file @
2c4fe935
...
@@ -33,7 +33,7 @@ func Clean(path string) error {
...
@@ -33,7 +33,7 @@ func Clean(path string) error {
return
nil
return
nil
}
}
func
Build
(
dir
string
,
isDebug
bool
)
error
{
func
Build
(
dir
string
,
module
string
,
isDebug
bool
)
error
{
currentDir
,
_
:=
os
.
Getwd
()
currentDir
,
_
:=
os
.
Getwd
()
fullPath
:=
currentDir
+
"/core/"
+
dir
fullPath
:=
currentDir
+
"/core/"
+
dir
...
@@ -46,8 +46,8 @@ func Build(dir string, isDebug bool) error {
...
@@ -46,8 +46,8 @@ func Build(dir string, isDebug bool) error {
outputDir
:=
fmt
.
Sprintf
(
currentDir
+
`/core/build/handlers/%v`
,
handler
)
outputDir
:=
fmt
.
Sprintf
(
currentDir
+
`/core/build/handlers/%v`
,
handler
)
outputFile
:=
fmt
.
Sprintf
(
`%v/%v`
,
outputDir
,
handler
)
outputFile
:=
fmt
.
Sprintf
(
`%v/%v`
,
outputDir
,
handler
)
appPath
:=
fmt
.
Sprintf
(
`
gitlab.com/ship-logic/backends/backend
/core/%v`
,
handler
)
appPath
:=
fmt
.
Sprintf
(
`
%v
/core/%v`
,
module
,
handler
)
err
:=
BuildGolangApp
(
outputFile
,
appPath
,
isDebug
)
err
:=
BuildGolangApp
(
outputFile
,
appPath
,
module
,
isDebug
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -75,10 +75,10 @@ func Build(dir string, isDebug bool) error {
...
@@ -75,10 +75,10 @@ func Build(dir string, isDebug bool) error {
return
nil
return
nil
}
}
func
BuildGolangApp
(
outputDir
string
,
appPath
string
,
isDebug
bool
)
error
{
func
BuildGolangApp
(
outputDir
string
,
appPath
string
,
module
string
,
isDebug
bool
)
error
{
commandArgs
:=
[]
string
{
commandArgs
:=
[]
string
{
`build`
,
`build`
,
fmt
.
Sprintf
(
`-ldflags=-X
gitlab.com/ship-logic/backends/backend/globals.BuildVersion=%v -X gitlab.com/ship-logic/backends/backend/globals.OSType=%v -X gitlab.com/ship-logic/backends/backend
/globals.IsDebugBuild=%v`
,
CurrentCommit
(),
runtime
.
GOOS
,
isDebug
),
fmt
.
Sprintf
(
`-ldflags=-X
%v/globals.BuildVersion=%v -X %v/globals.OSType=%v -X %v
/globals.IsDebugBuild=%v`
,
module
,
CurrentCommit
(),
module
,
runtime
.
GOOS
,
module
,
isDebug
),
}
}
if
isDebug
{
if
isDebug
{
...
...
...
...
This diff is collapsed.
Click to expand it.
cdk.go
+
10
−
10
View file @
2c4fe935
...
@@ -27,7 +27,7 @@ func CDKCompileTypeScript(cdkDir string) error {
...
@@ -27,7 +27,7 @@ func CDKCompileTypeScript(cdkDir string) error {
return
nil
return
nil
}
}
func
CDKDiff
(
cdkDir
string
,
env
string
,
stack
string
,
local
bool
)
error
{
func
CDKDiff
(
cdkDir
string
,
env
string
,
stack
string
,
local
bool
,
profile
string
)
error
{
fmt
.
Println
(
"Getting Diff for: "
+
stack
)
fmt
.
Println
(
"Getting Diff for: "
+
stack
)
commandArgs
:=
[]
string
{
commandArgs
:=
[]
string
{
...
@@ -42,7 +42,7 @@ func CDKDiff(cdkDir string, env string, stack string, local bool) error {
...
@@ -42,7 +42,7 @@ func CDKDiff(cdkDir string, env string, stack string, local bool) error {
}
}
if
local
{
if
local
{
commandArgs
=
append
(
commandArgs
,
fmt
.
Sprintf
(
`--profile=
shiplogic-%v`
,
env
))
commandArgs
=
append
(
commandArgs
,
fmt
.
Sprintf
(
`--profile=
%v`
,
profile
))
}
}
commandArgs
=
append
(
commandArgs
,
commandArgs
=
append
(
commandArgs
,
...
@@ -63,7 +63,7 @@ func CDKDiff(cdkDir string, env string, stack string, local bool) error {
...
@@ -63,7 +63,7 @@ func CDKDiff(cdkDir string, env string, stack string, local bool) error {
return
nil
return
nil
}
}
func
CDKDeploy
(
cdkDir
string
,
env
string
,
stack
string
,
exclusively
bool
,
local
bool
)
error
{
func
CDKDeploy
(
cdkDir
string
,
env
string
,
stack
string
,
exclusively
bool
,
local
bool
,
profile
string
)
error
{
commandArgs
:=
[]
string
{
commandArgs
:=
[]
string
{
`deploy`
,
`deploy`
,
fmt
.
Sprintf
(
`"%s"`
,
stack
),
fmt
.
Sprintf
(
`"%s"`
,
stack
),
...
@@ -77,7 +77,7 @@ func CDKDeploy(cdkDir string, env string, stack string, exclusively bool, local
...
@@ -77,7 +77,7 @@ func CDKDeploy(cdkDir string, env string, stack string, exclusively bool, local
}
}
if
local
{
if
local
{
commandArgs
=
append
(
commandArgs
,
fmt
.
Sprintf
(
`--profile=
shiplogic-%v`
,
env
))
commandArgs
=
append
(
commandArgs
,
fmt
.
Sprintf
(
`--profile=
%v`
,
profile
))
commandArgs
=
append
(
commandArgs
,
`--hotswap`
)
// make it go fast
commandArgs
=
append
(
commandArgs
,
`--hotswap`
)
// make it go fast
}
}
...
@@ -103,7 +103,7 @@ func CDKDeploy(cdkDir string, env string, stack string, exclusively bool, local
...
@@ -103,7 +103,7 @@ func CDKDeploy(cdkDir string, env string, stack string, exclusively bool, local
return
nil
return
nil
}
}
func
CDKSynthAll
(
cdkDir
string
,
env
string
,
local
bool
)
error
{
func
CDKSynthAll
(
cdkDir
string
,
env
string
,
profile
string
,
local
bool
)
error
{
commandArgs
:=
[]
string
{
commandArgs
:=
[]
string
{
`synth`
,
`synth`
,
`"*"`
,
`"*"`
,
...
@@ -114,7 +114,7 @@ func CDKSynthAll(cdkDir string, env string, local bool) error {
...
@@ -114,7 +114,7 @@ func CDKSynthAll(cdkDir string, env string, local bool) error {
}
}
if
local
{
if
local
{
commandArgs
=
append
(
commandArgs
,
fmt
.
Sprintf
(
`--profile=
shiplogic-%v`
,
env
))
commandArgs
=
append
(
commandArgs
,
fmt
.
Sprintf
(
`--profile=
%v`
,
profile
))
}
}
commandArgs
=
append
(
commandArgs
,
commandArgs
=
append
(
commandArgs
,
...
@@ -135,7 +135,7 @@ func CDKSynthAll(cdkDir string, env string, local bool) error {
...
@@ -135,7 +135,7 @@ func CDKSynthAll(cdkDir string, env string, local bool) error {
return
nil
return
nil
}
}
func
CDKSynthDebug
(
cdkDir
string
,
env
string
,
handler
string
)
error
{
func
CDKSynthDebug
(
cdkDir
string
,
env
string
,
handler
string
,
appName
string
,
profile
string
)
error
{
// Check if sandbox environment is active and get the sandbox name from the config file
// Check if sandbox environment is active and get the sandbox name from the config file
sandboxFilePath
:=
"cdk/sandbox/config.dev.sandbox.yaml"
sandboxFilePath
:=
"cdk/sandbox/config.dev.sandbox.yaml"
sandboxName
:=
""
sandboxName
:=
""
...
@@ -157,9 +157,9 @@ func CDKSynthDebug(cdkDir string, env string, handler string) error {
...
@@ -157,9 +157,9 @@ func CDKSynthDebug(cdkDir string, env string, handler string) error {
var
stack
string
var
stack
string
if
len
(
sandboxName
)
==
0
{
if
len
(
sandboxName
)
==
0
{
stack
=
fmt
.
Sprintf
(
"
shiplogic-backend-%v-core"
,
env
)
stack
=
fmt
.
Sprintf
(
"
%v-%v-core"
,
appName
,
env
)
}
else
{
}
else
{
stack
=
fmt
.
Sprintf
(
"s
l
-%v-%v-core"
,
env
,
sandboxName
)
stack
=
fmt
.
Sprintf
(
"s
andbox
-%v-%v-core"
,
env
,
sandboxName
)
}
}
commandArgs
:=
[]
string
{
commandArgs
:=
[]
string
{
...
@@ -167,7 +167,7 @@ func CDKSynthDebug(cdkDir string, env string, handler string) error {
...
@@ -167,7 +167,7 @@ func CDKSynthDebug(cdkDir string, env string, handler string) error {
stack
,
stack
,
`-c`
,
`-c`
,
fmt
.
Sprintf
(
`config=%v`
,
env
),
fmt
.
Sprintf
(
`config=%v`
,
env
),
fmt
.
Sprintf
(
"--profile=
shiplogic-%v"
,
env
),
fmt
.
Sprintf
(
"--profile=
%v"
,
profile
),
`--require-approval=never`
,
`--require-approval=never`
,
`--exclusively=true`
,
`--exclusively=true`
,
`--no-staging`
,
`--no-staging`
,
...
...
...
...
This diff is collapsed.
Click to expand it.
debug.go
+
4
−
4
View file @
2c4fe935
...
@@ -14,7 +14,7 @@ import (
...
@@ -14,7 +14,7 @@ import (
"github.com/docker/docker/client"
"github.com/docker/docker/client"
)
)
func
SamStartApi
(
ctx
context
.
Context
,
env
string
,
hand
le
r
string
,
debug
bool
)
error
{
func
SamStartApi
(
ctx
context
.
Context
,
handler
string
,
profi
le
string
,
debug
bool
)
error
{
stopRunningSamDocker
()
stopRunningSamDocker
()
usr
,
_
:=
user
.
Current
()
usr
,
_
:=
user
.
Current
()
...
@@ -35,7 +35,7 @@ func SamStartApi(ctx context.Context, env string, handler string, debug bool) er
...
@@ -35,7 +35,7 @@ func SamStartApi(ctx context.Context, env string, handler string, debug bool) er
}
}
commandArgs
=
append
(
commandArgs
,
commandArgs
=
append
(
commandArgs
,
fmt
.
Sprintf
(
`--profile=
shiplogic-%v`
,
env
),
fmt
.
Sprintf
(
`--profile=
%v`
,
profile
),
fmt
.
Sprintf
(
`--template=core/%v/template.yml`
,
handler
),
fmt
.
Sprintf
(
`--template=core/%v/template.yml`
,
handler
),
`--region=af-south-1`
)
`--region=af-south-1`
)
...
@@ -47,7 +47,7 @@ func SamStartApi(ctx context.Context, env string, handler string, debug bool) er
...
@@ -47,7 +47,7 @@ func SamStartApi(ctx context.Context, env string, handler string, debug bool) er
return
nil
return
nil
}
}
func
SamInvokeSQS
(
ctx
context
.
Context
,
env
string
,
handler
string
,
function
string
)
error
{
func
SamInvokeSQS
(
ctx
context
.
Context
,
handler
string
,
function
string
,
profile
string
)
error
{
stopRunningSamDocker
()
stopRunningSamDocker
()
usr
,
_
:=
user
.
Current
()
usr
,
_
:=
user
.
Current
()
...
@@ -63,7 +63,7 @@ func SamInvokeSQS(ctx context.Context, env string, handler string, function stri
...
@@ -63,7 +63,7 @@ func SamInvokeSQS(ctx context.Context, env string, handler string, function stri
`--debug-port=5986`
,
`--debug-port=5986`
,
fmt
.
Sprintf
(
`--debugger-path=%s`
,
delveDir
),
fmt
.
Sprintf
(
`--debugger-path=%s`
,
delveDir
),
`--debug-args=-delveAPI=2`
,
`--debug-args=-delveAPI=2`
,
fmt
.
Sprintf
(
`--profile=
shiplogic-%v`
,
env
),
fmt
.
Sprintf
(
`--profile=
%v`
,
profile
),
fmt
.
Sprintf
(
`--template=core/%v/template.yml`
,
handler
),
fmt
.
Sprintf
(
`--template=core/%v/template.yml`
,
handler
),
`--region=af-south-1`
,
`--region=af-south-1`
,
}
}
...
...
...
...
This diff is collapsed.
Click to expand it.
s3.go
+
2
−
2
View file @
2c4fe935
...
@@ -11,7 +11,7 @@ import (
...
@@ -11,7 +11,7 @@ import (
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3"
)
)
func
UploadToS3
(
env
string
,
bucket
string
,
filePath
string
,
name
string
,
local
bool
)
error
{
func
UploadToS3
(
profile
string
,
bucket
string
,
filePath
string
,
name
string
,
local
bool
)
error
{
fmt
.
Println
(
fmt
.
Sprintf
(
"Uploading %s to %s"
,
filePath
,
bucket
))
fmt
.
Println
(
fmt
.
Sprintf
(
"Uploading %s to %s"
,
filePath
,
bucket
))
options
:=
session
.
Options
{
options
:=
session
.
Options
{
...
@@ -21,7 +21,7 @@ func UploadToS3(env string, bucket string, filePath string, name string, local b
...
@@ -21,7 +21,7 @@ func UploadToS3(env string, bucket string, filePath string, name string, local b
}
}
if
local
{
if
local
{
options
.
Profile
=
fmt
.
Sprintf
(
"shiplogic-%s"
,
env
)
options
.
Profile
=
profile
}
}
sess
,
err
:=
session
.
NewSessionWithOptions
(
options
)
sess
,
err
:=
session
.
NewSessionWithOptions
(
options
)
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment