Skip to content

Commit

Permalink
Release (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
asalkeld authored Dec 6, 2022
2 parents 916f787 + eaf2b60 commit 92b2830
Show file tree
Hide file tree
Showing 13 changed files with 319 additions and 189 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/local-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ jobs:
run: |
cd ${{ github.workspace }}/test-app
make test
env:
BASE_URL: http://localhost:4001
TOPIC_BASE_URL: "http://localhost:4000/topic"

- name: Archive logfile
uses: actions/upload-artifact@v3
Expand Down
6 changes: 1 addition & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require (
github.com/missionMeteora/toolkit v0.0.0-20170713173850-88364e3ef8cc
github.com/moby/moby v20.10.21+incompatible
github.com/nitrictech/go-mods-direct v0.0.0-20221124004415-e2ce7ec20618
github.com/nitrictech/nitric v0.21.0-rc.2
github.com/nitrictech/nitric v0.21.0
github.com/nitrictech/pulumi-docker-buildkit/sdk/v0.1.21/dockerbuildkit v0.0.0-20221128004642-afea0486c727
github.com/pkg/errors v0.9.1
github.com/pterm/pterm v0.12.49
Expand All @@ -56,10 +56,6 @@ require (
)

require (
github.com/aws/aws-sdk-go-v2 v1.17.1
github.com/aws/aws-sdk-go-v2/config v1.17.10
github.com/aws/aws-sdk-go-v2/credentials v1.12.23
github.com/aws/aws-sdk-go-v2/service/s3 v1.29.1
github.com/pulumi/pulumi-azure-native-sdk/apimanagement v1.87.0
github.com/pulumi/pulumi-azure-native-sdk/app v1.87.0
github.com/pulumi/pulumi-azure-native-sdk/authorization v1.87.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1660,8 +1660,8 @@ github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm
github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c=
github.com/nitrictech/go-mods-direct v0.0.0-20221124004415-e2ce7ec20618 h1:nHCmSvLWJUehCabPo+STGUM6cTzCLJsoYuuJEJ9qT84=
github.com/nitrictech/go-mods-direct v0.0.0-20221124004415-e2ce7ec20618/go.mod h1:jqImBS1Tsk12vV2Gk7yP9+jajhpG+cHXrg7UhVxFruQ=
github.com/nitrictech/nitric v0.21.0-rc.2 h1:MeWyrhuIaPotJ5JVKWlkjThlg8KT8wGkuCAILZOo4kc=
github.com/nitrictech/nitric v0.21.0-rc.2/go.mod h1:znfsJ8tcBwFBVIPUGz1OA1PfsuyHHgn/3vBTnlqJLI8=
github.com/nitrictech/nitric v0.21.0 h1:DMhFTDjlK39dAJR6h3xirJHHQJgwQoY7cbmNXMqpPSQ=
github.com/nitrictech/nitric v0.21.0/go.mod h1:znfsJ8tcBwFBVIPUGz1OA1PfsuyHHgn/3vBTnlqJLI8=
github.com/nitrictech/protoutils v0.0.0-20220321044654-02667a814cdf h1:8MB8W8ylM8sCM2COGfiO39/tB6BTdiawLszaUGCNL5w=
github.com/nitrictech/protoutils v0.0.0-20220321044654-02667a814cdf/go.mod h1:b2lzk2a4o1bvSrSCE6yvTldHuXCJymuDVhdMJGOSslw=
github.com/nitrictech/pulumi-docker-buildkit/sdk/v0.1.21/dockerbuildkit v0.0.0-20221128004642-afea0486c727 h1:rhQJfc5vl6/ahUH3hrGUteaw84vpOu7OtJqz41yJosM=
Expand Down
20 changes: 16 additions & 4 deletions pkg/cmd/run/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var runCmd = &cobra.Command{
cobra.CheckErr(err)
}

ls := run.NewLocalServices(proj)
ls := run.NewLocalServices(proj, false)
if ls.Running() {
pterm.Error.Println("Only one instance of Nitric can be run locally at a time, please check that you have ended all other instances and try again")
os.Exit(2)
Expand Down Expand Up @@ -145,7 +145,14 @@ var runCmd = &cobra.Command{

pterm.DefaultBasicText.Println("Application running, use ctrl-C to stop")

stackState := run.StateFromPool(pool)
stackState := run.NewStackState()

err = ls.Refresh()
if err != nil {
cobra.CheckErr(err)
}

stackState.Update(pool, ls)

area, _ := pterm.DefaultArea.Start()
area.Update(stackState.Tables(9001))
Expand All @@ -155,9 +162,14 @@ var runCmd = &cobra.Command{
pool.Listen(func(we run.WorkerEvent) {
lck.Lock()
defer lck.Unlock()
// area.Clear()

stackState.UpdateFromWorkerEvent(we)
err := ls.Refresh()
if err != nil {
cobra.CheckErr(err)
}

stackState.Update(pool, ls)

area.Update(stackState.Tables(9001))
})

Expand Down
23 changes: 6 additions & 17 deletions pkg/cmd/start/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"log"
"os"
"os/signal"
"strings"
"sync"
"syscall"
"time"
Expand Down Expand Up @@ -52,7 +51,7 @@ var startCmd = &cobra.Command{

ls := run.NewLocalServices(&project.Project{
Name: "local",
})
}, true)
if ls.Running() {
pterm.Error.Println("Only one instance of Nitric can be run locally at a time, please check that you have ended all other instances and try again")
os.Exit(2)
Expand Down Expand Up @@ -103,24 +102,14 @@ var startCmd = &cobra.Command{
defer lck.Unlock()
// area.Clear()

stackState.UpdateFromWorkerEvent(we)

tables := []string{}
table, rows := stackState.ApiTable(9001)
if rows > 0 {
tables = append(tables, table)
err := ls.Refresh()
if err != nil {
cobra.CheckErr(err)
}

table, rows = stackState.TopicTable(9001)
if rows > 0 {
tables = append(tables, table)
}
stackState.Update(pool, ls)

table, rows = stackState.SchedulesTable(9001)
if rows > 0 {
tables = append(tables, table)
}
area.Update(strings.Join(tables, "\n\n"))
area.Update(stackState.Tables(9001))
})

select {
Expand Down
10 changes: 10 additions & 0 deletions pkg/provider/pulumi/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,8 @@ func (a *awsProvider) Deploy(ctx *pulumi.Context) error {
}
}

uniquePolicies := make(map[string]bool)

for _, p := range a.proj.Policies {
if len(p.Actions) == 0 {
// note Topic receiving does not require an action.
Expand All @@ -475,6 +477,14 @@ func (a *awsProvider) Deploy(ctx *pulumi.Context) error {
return err
}

_, ok := uniquePolicies[policyName]
if ok {
// no point creating multiple policies with the same content.
continue
}

uniquePolicies[policyName] = true

if _, err := newPolicy(ctx, policyName, &PolicyArgs{
Policy: p,
Resources: &StackResources{
Expand Down
3 changes: 3 additions & 0 deletions pkg/provider/pulumi/azure/apimanagement.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ import (
"github.com/pulumi/pulumi-azure-native-sdk/managedidentity"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"

"github.com/nitrictech/cli/pkg/provider/pulumi/common"
v1 "github.com/nitrictech/nitric/pkg/api/nitric/v1"
)

type AzureApiManagementArgs struct {
StackID pulumi.StringInput
ResourceGroupName pulumi.StringInput
OrgName pulumi.StringInput
AdminEmail pulumi.StringInput
Expand Down Expand Up @@ -110,6 +112,7 @@ func newAzureApiManagement(ctx *pulumi.Context, name string, args *AzureApiManag
Type: pulumi.String("UserAssigned"),
UserAssignedIdentities: managedIdentities,
},
Tags: common.Tags(ctx, args.StackID, name),
})
if err != nil {
return nil, err
Expand Down
1 change: 1 addition & 0 deletions pkg/provider/pulumi/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ func (a *azureProvider) Deploy(ctx *pulumi.Context) error {
Apps: apps.Apps,
SecurityDefinitions: a.proj.SecurityDefinitions[k],
ManagedIdentity: managedUser,
StackID: a.stackID,
})
if err != nil {
return errors.WithMessage(err, "gateway "+k)
Expand Down
Loading

0 comments on commit 92b2830

Please sign in to comment.