Skip to content

Commit

Permalink
Fix bug in dev env add for updating repo mirrors in local cache
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanjli committed May 26, 2023
1 parent 003b14b commit 4849760
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## 0.1.5 - 2023-05-26

### Fixed

- Previously, the `dev env add` command did not correctly update the local cache's mirrors of remote Git repositories. Now it should (probably) update them correctly.

## 0.1.4 - 2023-05-24

### Added
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ You can also use the `forklift dev env add-repo` command to add additional Palle

You can also run commands like `forklift dev env cache` and `sudo -E forklift dev env deploy` (with appropriate values in the `--cwd` flag if necessary) to download the Pallet repositories specified by your development environment into your local cache and deploy the packages provided by those repositories according to the configuration in your development environment. This is useful if, for example, you want to make some experimental changes to your development environment and test them on your local machine before committing and pushing those changes onto GitHub.

## Similar projects

The following projects solve related problems with containers, though they make different trade-offs compared to Forklift and Pallets:

- Terraform (an inspiration for this project) has a Docker Provider which enables declarative management of Docker hosts and Swarms from a Terraform configuration: https://registry.terraform.io/providers/kreuzwerker/docker/latest/docs
- swarm-pack (an inspiration for this project) uses collections of packages from user-specified Git repositories and enables templated configuration of Docker Compose files, with imperative deployments of packages: https://github.com/swarm-pack/swarm-pack
- SwarmManagement uses a single YAML file for declarative configuration of an entire Docker Swarm: https://github.com/hansehe/SwarmManagement
- Podman Quadlets enable management of containers, volumes, and networks using declarative systemd units: https://docs.podman.io/en/latest/markdown/podman-systemd.unit.5.html
- Projects developing GitOps tools such as ArgoCD, Flux, etc., store container environment configurations as Git repositories but are generally designed for Kubernetes: https://www.gitops.tech/

## Licensing

Except where otherwise indicated, source code provided here is covered by the following information:
Expand Down
2 changes: 1 addition & 1 deletion cmd/forklift/dev-env.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func updateLocalRepoMirrors(remoteReleases []string, cachePath string) error {
func updateLocalRepoMirror(remote, cachedPath string) error {
if _, err := os.Stat(cachedPath); err == nil {
fmt.Printf("Fetching updates for %s...\n", cachedPath)
if _, err = git.Prune(cachedPath); err == nil {
if _, err = git.Fetch(cachedPath); err == nil {
return err
}
fmt.Printf(
Expand Down
2 changes: 1 addition & 1 deletion cmd/forklift/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func envCacheAction(c *cli.Context) error {

// TODO: download all Docker images used by packages in the repo - either by inspecting the
// Docker stack definitions or by allowing packages to list Docker images used.
fmt.Println("Done! Next, you'll probably want to run `forklift env deploy`.")
fmt.Println("Done! Next, you'll probably want to run `sudo -E forklift env deploy`.")
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/forklift/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var app = &cli.App{
Name: "forklift",
// TODO: see if there's a way to get the version from a build tag, so that we don't have to update
// this manually
Version: "v0.1.4",
Version: "v0.1.5",
Usage: "Manages Pallet repositories and package deployments",
Commands: []*cli.Command{
envCmd,
Expand Down

0 comments on commit 4849760

Please sign in to comment.