Skip to content

Commit

Permalink
addressed review comments.
Browse files Browse the repository at this point in the history
Signed-off-by: Evan <[email protected]>
  • Loading branch information
evanchaoli committed Jan 6, 2023
1 parent 3b1c634 commit f596b78
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,9 @@ jobs:
```

In above classic mode, Concourse will run periodic checks against the `semver`
resource `version`. Each check will do a `git clone` as the driver is `git`. On
a large deployment that hosts thousands of pipelines, when there are a lot of
`semver` resources, checks on `semver` resources may also bring burden to the
git system as each check will invoke a `git clone`.
resource `version`. Each check will do a `git clone` as the driver is `git`.
When there are a lot of `semver` resources, checks on `semver` resources may
also bring burden to the git system as each check will invoke a `git clone`.

Given each `semver` resource requires a parameter `file` in `source`, `semver`
resources are hard to enjoy [benefits of global resources](https://concourse-ci.org/global-resources.html#benefits-of-global-resources).
Expand All @@ -310,8 +309,8 @@ jobs:
You may have noticed that, original `get: version` is changed to `put: version`.
Now resource `version` is put-only, then Concourse will no longer run check on
it. Param `get_latest: true` tells the `put` step to only fetch the latest version
without bumping anything. Then the implied `get` will make a bump as the original
`get: version`.
without bumping anything. Then the implied `get` will fetch a version as a typical
`get` step.

If your Concourse or Git (e.g. Gitlab) systems are exhausted by `semver` resources'
checks, you may consider reforming pipelines to use this check-less usage.
Expand Down
9 changes: 3 additions & 6 deletions driver/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package driver
import (
"errors"
"fmt"
"io/ioutil"
"net/mail"
"os"
"os/exec"
Expand Down Expand Up @@ -225,7 +224,7 @@ func (driver *GitDriver) setUpKey() error {
if err != nil {
if os.IsNotExist(err) {
privateKey := strings.TrimSuffix(driver.PrivateKey, "\n")
err := ioutil.WriteFile(privateKeyPath, []byte(privateKey+"\n"), 0600)
err := os.WriteFile(privateKeyPath, []byte(privateKey+"\n"), 0600)
if err != nil {
return err
}
Expand Down Expand Up @@ -254,7 +253,7 @@ func (driver *GitDriver) setUpUsernamePassword() error {
if err != nil {
if os.IsNotExist(err) {
content := fmt.Sprintf("default login %s password %s", driver.Username, driver.Password)
err := ioutil.WriteFile(netRcPath, []byte(content), 0600)
err := os.WriteFile(netRcPath, []byte(content), 0600)
if err != nil {
return err
}
Expand Down Expand Up @@ -322,8 +321,6 @@ func (driver *GitDriver) readVersion() (semver.Version, bool, error) {

const nothingToCommitString = "nothing to commit"
const falsePushString = "Everything up-to-date"
//const pushRejectedString = "[rejected]"
//const pushRemoteRejectedString = "[remote rejected]"

func (driver *GitDriver) writeVersion(newVersion semver.Version) (bool, error) {

Expand All @@ -335,7 +332,7 @@ func (driver *GitDriver) writeVersion(newVersion semver.Version) (bool, error) {
}
}

err := ioutil.WriteFile(filepath.Join(gitRepoDir, driver.File), []byte(newVersion.String()+"\n"), 0644)
err := os.WriteFile(filepath.Join(gitRepoDir, driver.File), []byte(newVersion.String()+"\n"), 0644)
if err != nil {
return false, err
}
Expand Down

0 comments on commit f596b78

Please sign in to comment.