New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: clean manifest path in remote deploy to fix regression #4195
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #4195 +/- ##
==========================================
- Coverage 45.71% 45.68% -0.04%
==========================================
Files 291 292 +1
Lines 27198 27194 -4
==========================================
- Hits 12434 12424 -10
- Misses 13676 13680 +4
- Partials 1088 1090 +2 |
Signed-off-by: Andrea Falzetti <andrea@okteto.com>
Signed-off-by: Andrea Falzetti <andrea@okteto.com>
Signed-off-by: Andrea Falzetti <andrea@okteto.com>
ff0268b
to
736fd0d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to have that logic also in the destroy. Check my inline comment
cmd/deploy/remote.go
Outdated
@@ -327,6 +327,19 @@ func (rd *remoteDeployCommand) createDockerfile(tmpDir string, opts *Options) (s | |||
return dockerfile.Name(), nil | |||
} | |||
|
|||
// cleanManifestPath removes the path to the manifest file, in case the command was executed from a parent or child folder | |||
func cleanManifestPath(manifestPath string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add this same logic in the destroy? If the destroy has some commands to be executed, it won't execute them, but the dev-environment will be deleted.
I have tested it adding this to your example:
destroy:
remote: true
commands:
- echo "Hello world"
If you execute okteto destroy -f apps/service/okteto.yml
, it doesn't run the echo command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ifbyol good point, I've made the changes for destroy and moved the cleanManifestPath
to a shared place. Can you please have another go at the review?
Signed-off-by: Andrea Falzetti <andrea@okteto.com>
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release-2.25 release-2.25
# Navigate to the new working tree
cd .worktrees/backport-release-2.25
# Create a new branch
git switch --create backport-4195-to-release-2.25
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 e568f2a875384e705af5adec861b667f048f8706
# Push it to GitHub
git push --set-upstream origin backport-4195-to-release-2.25
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release-2.25 Then, create a pull request where the |
--------- Signed-off-by: Andrea Falzetti <andrea@okteto.com>
* backport remote build context Signed-off-by: Andrea Falzetti <andrea@okteto.com> * fix: clean manifest path in remote deploy to fix regression (#4195) --------- Signed-off-by: Andrea Falzetti <andrea@okteto.com> * fix: getContextPath when manifestpath is subdir Signed-off-by: Andrea Falzetti <andrea@okteto.com> * clean should not return dot Signed-off-by: Andrea Falzetti <andrea@okteto.com> * fix: .okteto Signed-off-by: Andrea Falzetti <andrea@okteto.com> * fix: 2nd scenario Signed-off-by: Andrea Falzetti <andrea@okteto.com> * refactor: simplify and remove unnecessary code Signed-off-by: Andrea Falzetti <andrea@okteto.com> * fix: additional case Signed-off-by: Andrea Falzetti <andrea@okteto.com> --------- Signed-off-by: Andrea Falzetti <andrea@okteto.com>
Proposed changes
Fixes DEV-199
How to validate
git clone -b fix-dev-199 git@github.com:andreafalzetti/k8s-status-api.git
2.25.1
reproduce the bug by running:okteto up --deploy -f apps/service/okteto.yml
Okteto.yml file doesn't exist
okteto up
session, works as expectedRepeat the steps for
destroy
and make sure it works as expectedCLI Quality Reminders 馃敡
For both authors and reviewers: