Compare commits

...

3 Commits

9 changed files with 32 additions and 24 deletions

View File

@@ -1,5 +1,9 @@
# Changelog
## v0.8.1 (2018-09-10)
- Fix issue where changes were not pulled when tracking a branch (issue #567)
- Fix controller hot loop when app source contains bad manifests (issue #568)
## v0.8.0 (2018-09-04)
### Notes about upgrading from v0.7

View File

@@ -1 +1 @@
0.8.0
0.8.1

View File

@@ -487,13 +487,14 @@ func (ctrl *ApplicationController) processAppRefreshQueueItem() (processNext boo
// Returns true if application never been compared, has changed or comparison result has expired.
func (ctrl *ApplicationController) needRefreshAppStatus(app *appv1.Application, statusRefreshTimeout time.Duration) bool {
var reason string
expired := app.Status.ComparisonResult.ComparedAt.Add(statusRefreshTimeout).Before(time.Now().UTC())
if ctrl.isRefreshForced(app.Name) {
reason = "force refresh"
} else if app.Status.ComparisonResult.Status == appv1.ComparisonStatusUnknown {
} else if app.Status.ComparisonResult.Status == appv1.ComparisonStatusUnknown && expired {
reason = "comparison status unknown"
} else if !app.Spec.Source.Equals(app.Status.ComparisonResult.ComparedTo) {
reason = "spec.source differs"
} else if app.Status.ComparisonResult.ComparedAt.Add(statusRefreshTimeout).Before(time.Now().UTC()) {
} else if expired {
reason = fmt.Sprintf("comparison expired. comparedAt: %v, expiry: %v", app.Status.ComparisonResult.ComparedAt, statusRefreshTimeout)
}
if reason != "" {

View File

@@ -14,6 +14,6 @@ spec:
spec:
containers:
- command: [/argocd-application-controller, --repo-server, 'argocd-repo-server:8081']
image: argoproj/argocd-application-controller:v0.8.0
image: argoproj/argocd-application-controller:v0.8.1
name: application-controller
serviceAccountName: application-controller

View File

@@ -15,20 +15,20 @@ spec:
serviceAccountName: argocd-server
initContainers:
- name: copyutil
image: argoproj/argocd-server:v0.8.0
image: argoproj/argocd-server:v0.8.1
command: [cp, /argocd-util, /shared]
volumeMounts:
- mountPath: /shared
name: static-files
- name: ui
image: argoproj/argocd-ui:v0.8.0
image: argoproj/argocd-ui:v0.8.1
command: [cp, -r, /app, /shared]
volumeMounts:
- mountPath: /shared
name: static-files
containers:
- name: argocd-server
image: argoproj/argocd-server:v0.8.0
image: argoproj/argocd-server:v0.8.1
command: [/argocd-server, --staticassets, /shared/app, --repo-server, 'argocd-repo-server:8081']
volumeMounts:
- mountPath: /shared

View File

@@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: argocd-repo-server
image: argoproj/argocd-repo-server:v0.8.0
image: argoproj/argocd-repo-server:v0.8.1
command: [/argocd-repo-server]
ports:
- containerPort: 8081

View File

@@ -165,7 +165,7 @@ spec:
spec:
containers:
- command: [/argocd-application-controller, --repo-server, 'argocd-repo-server:8081']
image: argoproj/argocd-application-controller:v0.8.0
image: argoproj/argocd-application-controller:v0.8.1
name: application-controller
serviceAccountName: application-controller
---
@@ -241,20 +241,20 @@ spec:
serviceAccountName: argocd-server
initContainers:
- name: copyutil
image: argoproj/argocd-server:v0.8.0
image: argoproj/argocd-server:v0.8.1
command: [cp, /argocd-util, /shared]
volumeMounts:
- mountPath: /shared
name: static-files
- name: ui
image: argoproj/argocd-ui:v0.8.0
image: argoproj/argocd-ui:v0.8.1
command: [cp, -r, /app, /shared]
volumeMounts:
- mountPath: /shared
name: static-files
containers:
- name: argocd-server
image: argoproj/argocd-server:v0.8.0
image: argoproj/argocd-server:v0.8.1
command: [/argocd-server, --staticassets, /shared/app, --repo-server, 'argocd-repo-server:8081']
volumeMounts:
- mountPath: /shared
@@ -307,7 +307,7 @@ spec:
spec:
containers:
- name: argocd-repo-server
image: argoproj/argocd-repo-server:v0.8.0
image: argoproj/argocd-repo-server:v0.8.1
command: [/argocd-repo-server]
ports:
- containerPort: 8081

View File

@@ -82,7 +82,7 @@ func (s *Service) ListDir(ctx context.Context, q *ListDirRequest) (*FileList, er
return &res, nil
}
err = checkoutRevision(gitClient, q.Revision)
err = checkoutRevision(gitClient, commitSHA)
if err != nil {
return nil, err
}
@@ -116,7 +116,11 @@ func (s *Service) GetFile(ctx context.Context, q *GetFileRequest) (*GetFileRespo
if err != nil {
return nil, err
}
err = checkoutRevision(gitClient, q.Revision)
commitSHA, err := gitClient.LsRemote(q.Revision)
if err != nil {
return nil, err
}
err = checkoutRevision(gitClient, commitSHA)
if err != nil {
return nil, err
}
@@ -165,7 +169,7 @@ func (s *Service) GenerateManifest(c context.Context, q *ManifestRequest) (*Mani
log.Infof("manifest cache miss: %s", cacheKey)
}
err = checkoutRevision(gitClient, q.Revision)
err = checkoutRevision(gitClient, commitSHA)
if err != nil {
return nil, err
}
@@ -280,16 +284,12 @@ func IdentifyAppSourceTypeByAppPath(appFilePath string) AppSourceType {
}
// checkoutRevision is a convenience function to initialize a repo, fetch, and checkout a revision
func checkoutRevision(gitClient git.Client, revision string) error {
func checkoutRevision(gitClient git.Client, commitSHA string) error {
err := gitClient.Fetch()
if err != nil {
return err
}
err = gitClient.Reset()
if err != nil {
log.Warn(err)
}
err = gitClient.Checkout(revision)
err = gitClient.Checkout(commitSHA)
if err != nil {
return err
}

View File

@@ -136,7 +136,7 @@ func (m *nativeGitClient) setCredentials() error {
func (m *nativeGitClient) Fetch() error {
var err error
log.Debugf("Fetching repo %s at %s", m.repoURL, m.root)
if _, err = m.runCmd("git", "fetch", "origin", "--tags"); err != nil {
if _, err = m.runCmd("git", "fetch", "origin", "--tags", "--force"); err != nil {
return err
}
// git fetch does not update the HEAD reference. The following command will update the local
@@ -192,7 +192,10 @@ func (m *nativeGitClient) Checkout(revision string) error {
if revision == "" || revision == "HEAD" {
revision = "origin/HEAD"
}
if _, err := m.runCmd("git", "checkout", revision); err != nil {
if _, err := m.runCmd("git", "checkout", "--force", revision); err != nil {
return err
}
if _, err := m.runCmd("git", "clean", "-fd"); err != nil {
return err
}
return nil