Skip to content

Commit 219e37c

Browse files
authored
Merge pull request #7 from StamusNetworks/trunk
Rebasing trunk in main
2 parents 67ee21c + 76aae00 commit 219e37c

File tree

7 files changed

+37
-18
lines changed

7 files changed

+37
-18
lines changed

.github/workflows/release.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ jobs:
6161
include:
6262
- { runner: ubuntu-latest, os: linux, arch: amd64, go-version: 1.22 }
6363

64-
# permissions:
65-
# contents: write # to be able to publish a GitHub release
66-
# issues: write # to be able to comment on released issues
67-
# pull-requests: write # to be able to comment on released pull requests
6864
steps:
6965
- name: Checkout
7066
uses: actions/checkout@v4

.gitlab-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ workflow:
77
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
88
- if: $CI_COMMIT_TAG
99
- if: $CI_COMMIT_BRANCH == "main"
10+
- if: $CI_COMMIT_BRANCH == "trunk" && $CI_PIPELINE_SOURCE != 'merge_request_event'
1011

1112
stages:
1213
- ut

cmd/ctl/compose/update.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ func updateCmd() *cobra.Command {
2626
// Add flags
2727
flags.Version.AddAsFlag(cmd, false)
2828
flags.Config.AddAsFlag(cmd, false)
29+
flags.Template.AddAsFlag(cmd, false)
30+
2931
return cmd
3032
}
3133

@@ -39,12 +41,17 @@ func updateHandler(_ *cobra.Command, args []string) {
3941
if err != nil {
4042
return
4143
}
44+
templateFolder, err := flags.Template.GetValue()
45+
if err != nil {
46+
return
47+
}
48+
4249
// Call handler
4350
params := handlers.UpdateHandlerParams{
4451
Version: version.(string),
4552
Config: config.(string),
53+
TemplateFolder: templateFolder.(string),
4654
Args: args,
47-
TemplateFolder: "",
4855
}
4956

5057
handlers.UpdateHandler(params)

gitlab/release.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,24 @@ delete-env-from-app-of-apps:
4949
release-to-github:
5050
stage: release
5151
image: bitnami/git
52-
needs:
53-
- full test w test config
5452
rules:
55-
- if: '$CI_COMMIT_BRANCH == "main"'
56-
when: on_success
53+
- if: $CI_COMMIT_BRANCH
54+
script:
55+
- git config --global user.email $GITLAB_USER_EMAIL
56+
- git config --global user.name $GITLAB_USER_NAME
57+
- git remote add github "https://$GITHUB_USERNAME:[email protected]/StamusNetworks/stamusctl.git"
58+
- git push -u --no-thin -f github HEAD:refs/heads/$CI_COMMIT_BRANCH
59+
60+
release-to-github-from-mr:
61+
stage: release
62+
image: bitnami/git
63+
rules:
64+
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
5765
script:
5866
- git config --global user.email $GITLAB_USER_EMAIL
5967
- git config --global user.name $GITLAB_USER_NAME
6068
- git remote add github "https://$GITHUB_USERNAME:[email protected]/StamusNetworks/stamusctl.git"
61-
- git fetch github
62-
- git checkout -b github-trunk
63-
- git branch --set-upstream-to github/trunk
64-
- git pull --rebase
65-
- git push github HEAD:trunk
69+
- git push -u --no-thin -f github HEAD:refs/heads/$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
6670

6771
upload stamusctl:
6872
stage: release

internal/docker-compose/wrapper.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@ var ComposeFlags = models.ComposeFlags{
3434
[]string{"file"},
3535
[]string{"volumes", "remove-orphans"},
3636
),
37+
"restart": models.CreateComposeFlags(
38+
[]string{"file"},
39+
[]string{},
40+
),
3741
"ps": models.CreateComposeFlags(
3842
[]string{"file"},
3943
[]string{"services", "quiet", "format"},
4044
),
4145
"logs": models.CreateComposeFlags(
4246
[]string{"file"},
43-
[]string{"timestamps", "tail", "since", "until"},
47+
[]string{"timestamps", "tail", "since", "until", "follow", "details"},
4448
),
4549
"pull": models.CreateComposeFlags(
4650
[]string{"file"},
@@ -119,6 +123,7 @@ func WrappedCmd(composeFlags models.ComposeFlags) ([]*cobra.Command, map[string]
119123
func modifyFileFlag(c *cobra.Command) {
120124
// Modify flags
121125
c.Flags().Lookup("file").Hidden = true
126+
c.Flags().Lookup("file").Shorthand = ""
122127
stamusFlags.Config.AddAsFlag(c, false)
123128
// Save the command
124129
currentRunE := c.RunE

internal/handlers/compose/init.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package handlers
22

33
import (
4+
"errors"
45
"os"
56
"path/filepath"
67
"strings"
@@ -142,7 +143,9 @@ func InitHandler(isCli bool, params InitHandlerInputs) error {
142143

143144
logger.Debug("Save config to: ", outputFile)
144145
if err = config.SaveConfigTo(outputFile, false, true); err != nil {
145-
return err
146+
if !errors.Is(err, models.ErrorEmptyFolder) {
147+
return err
148+
}
146149
}
147150

148151
// Bind files

internal/handlers/compose/update.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package handlers
33
import (
44
// Common
55

6+
"errors"
67
"fmt"
78
"os"
89
"os/exec"
@@ -178,9 +179,11 @@ func UpdateHandler(params UpdateHandlerParams) error {
178179
// Save the configuration
179180
err = newConfig.SaveConfigTo(confFile, true, false)
180181
if err != nil {
181-
logger.Error(err)
182+
if !errors.Is(err, models.ErrorEmptyFolder) {
183+
logger.Error(err)
182184

183-
return err
185+
return err
186+
}
184187
}
185188

186189
// Run post-run script

0 commit comments

Comments
 (0)