Commit Graph

4 Commits

Author SHA1 Message Date
Bolaji Olajide
067115910c
fix(ci): check command out for error when git fails (#63993)
Closes [#1110](https://github.com/sourcegraph/devx-support/issues/1110)
Closes DINF-96

We don't print the stdErr when a command fails … in particular when git
fails. Therefore we see very little in the panic of what went wrong.

Explanation:
> There's a weird behavior that occurs where an error isn't accessible
in the err variable
// from a *Cmd executing a git command after calling CombinedOutput().
// This occurs due to how Git handles errors and how the exec package in
Go interprets the command's output.
// Git often writes error messages to stderr, but it might still exit
with a status code of 0 (indicating success).
// In this case, CombinedOutput() won't return an error, but the error
message will be in the out variable.

## Test plan

Manual testing

```go
func main() {
	ctx := context.Background()
	cmd := exec.CommandContext(ctx, "git", "rev-parse", "--is-inside-work-tree")
	out, err := handleGitCommandExec(cmd)
	if err != nil {
		// er := errors.Wrap(err, fmt.Sprintf("idsdsd: %s", string(out)))
		panic(err)
	}
	fmt.Println("hello", string(out))
}
```

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-23 09:56:33 -05:00
Noah S-C
9b6ba7741e
bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
William Bezuidenhout
d2aa9e7e22
sg: cloud - trigger and list deployments (#62009)
* Add cloud api client for ephemeral

Created package sg/internal/cloud which connects to the cloud api.
From the examples it looks like we need to impersonate a service account
to get a token. For now I am just print the token from gcloud but will
sync with the cloud team on this tomorrow

add CLOUD_EPHEMERAL env to pipline env

move deploy command to cloud package

implement "deploy" aka creation of eph instance

determine latest tag locally

---------

Co-authored-by: Jean-Hadrien Chabran <jean-hadrien.chabran@sourcegraph.com>
2024-04-29 14:51:55 +02:00
William Bezuidenhout
42965898db
ci: move git operations from ci config to it's own package (#62000)
* ci: move git ops to own package

I needed the code that determines the latestTag for use in a branchTag
else where and it felt like a waste to just reimplement it elsewhere.

So I moved the git operations that the config was doing to its own
package that can be imported from somewhere else.

* move diffing also to gitops package for ci
2024-04-18 12:00:07 +02:00