-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mathieu Frenette <[email protected]>
- Loading branch information
Showing
7 changed files
with
60 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
#!/bin/bash | ||
set -e | ||
jen require PROJECT | ||
echo "Creating triggers on CI/CD pipelines for project $PROJECT" | ||
sleep 1 | ||
echo "Done." |
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
#!/bin/bash | ||
set -e | ||
jen require PROJECT | ||
echo "Creating docker image repo for project $PROJECT" | ||
sleep 1 | ||
echo "Done." |
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
#!/bin/bash | ||
set -e | ||
jen require PROJECT | ||
echo "Removing triggers from CI/CD pipelines for project $PROJECT" | ||
sleep 1 | ||
echo "Done." |
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
#!/bin/bash | ||
set -e | ||
jen require PROJECT | ||
echo "Removing docker image repo for project $PROJECT" | ||
sleep 1 | ||
echo "Done." |
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,36 @@ | ||
package require | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/Samasource/jen/src/cmd/internal" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// New creates a cobra command | ||
func New(options *internal.Options) *cobra.Command { | ||
return &cobra.Command{ | ||
Use: "require", | ||
Short: "Validates that all given variables are defined in current environment", | ||
RunE: func(_ *cobra.Command, args []string) error { | ||
return run(options, args) | ||
}, | ||
} | ||
} | ||
|
||
func run(options *internal.Options, args []string) error { | ||
valid := true | ||
for _, arg := range args { | ||
_, ok := os.LookupEnv(arg) | ||
if !ok { | ||
fmt.Fprintf(os.Stderr, "Missing required variable %q\n", arg) | ||
valid = false | ||
} | ||
} | ||
|
||
if !valid { | ||
os.Exit(1) | ||
} | ||
return nil | ||
} |
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