-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add explicit pull command for e2e to use that pulls from manifest
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
- Loading branch information
1 parent
d1140f3
commit 4dfe87b
Showing
6 changed files
with
119 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// Copyright © 2021 Kaleido, Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package cmd | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"time" | ||
|
||
"github.com/briandowns/spinner" | ||
"github.com/hyperledger/firefly-cli/internal/log" | ||
"github.com/hyperledger/firefly-cli/internal/stacks" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var pullCmd = &cobra.Command{ | ||
Use: "pull <stack_name>", | ||
Short: "Pull a stack", | ||
Long: `Pull a stack | ||
Pull the images for a stack . | ||
`, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
var spin *spinner.Spinner | ||
if fancyFeatures && !verbose { | ||
spin = spinner.New(spinner.CharSets[11], 100*time.Millisecond) | ||
spin.FinalMSG = "done" | ||
logger = &log.SpinnerLogger{ | ||
Spinner: spin, | ||
} | ||
} | ||
|
||
stackManager := stacks.NewStackManager(logger) | ||
if len(args) == 0 { | ||
return errors.New("no stack specified") | ||
} | ||
stackName := args[0] | ||
|
||
if err := stackManager.LoadStack(stackName); err != nil { | ||
return err | ||
} | ||
|
||
if runBefore, err := stackManager.StackHasRunBefore(); err != nil { | ||
return err | ||
} else if !runBefore { | ||
fmt.Println("this will take a few seconds longer since this is the first time you're running this stack...") | ||
} | ||
|
||
if spin != nil { | ||
spin.Start() | ||
} | ||
if err := stackManager.PullStack(verbose); err != nil { | ||
return err | ||
} | ||
if spin != nil { | ||
spin.Stop() | ||
} | ||
fmt.Print("\n\n") | ||
for _, member := range stackManager.Stack.Members { | ||
fmt.Printf("Web UI for member '%v': http://127.0.0.1:%v/ui\n", member.ID, member.ExposedFireflyPort) | ||
} | ||
fmt.Printf("\nTo see logs for your stack run:\n\n%s logs %s\n\n", rootCmd.Use, stackName) | ||
return nil | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(pullCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters