Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions hack/update-manifests.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
#!/bin/sh

SRCROOT="$( cd "$(dirname "$0")/.." ; pwd -P )"
set -e

SRCROOT="$( CDPATH='' cd -- "$(dirname "$0")/.." && pwd -P )"
AUTOGENMSG="# This is an auto-generated file. DO NOT EDIT"

update_image () {
if [ ! -z "${IMAGE_NAMESPACE}" ]; then
sed -i '' 's| image: \(.*\)/\(argocd.*\)| image: '"${IMAGE_NAMESPACE}"'/\2|g' ${1}
sed -i -- 's| image: \(.*\)/\(argocd.*\)| image: '"${IMAGE_NAMESPACE}"'/\2|g' "${1}"

@twz123 twz123 Nov 23, 2018

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure whether this is a BSD vs GNU thing, but the previous version failed for me on Linux. Hope this works on OSX, too?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tried it -- it works on OS X, so you're good.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops I spoke too soon, I think we need to follow something like:
https://stackoverflow.com/questions/5694228/sed-in-place-flag-that-works-both-on-mac-bsd-and-linux

to support in-place editing that works on both linux and mac

fi
if [ ! -z "${IMAGE_TAG}" ]; then
sed -i '' 's|\( image: .*/argocd.*\)\:.*|\1:'"${IMAGE_TAG}"'|g' ${1}
sed -i -- 's|\( image: .*/argocd.*\)\:.*|\1:'"${IMAGE_TAG}"'|g' "${1}"
fi
}

echo "${AUTOGENMSG}" > ${SRCROOT}/manifests/install.yaml
kustomize build ${SRCROOT}/manifests/cluster-install >> ${SRCROOT}/manifests/install.yaml
update_image ${SRCROOT}/manifests/install.yaml

echo "${AUTOGENMSG}" > ${SRCROOT}/manifests/namespace-install.yaml
kustomize build ${SRCROOT}/manifests/base >> ${SRCROOT}/manifests/namespace-install.yaml
update_image ${SRCROOT}/manifests/namespace-install.yaml
echo "${AUTOGENMSG}" > "${SRCROOT}/manifests/install.yaml"
kustomize build "${SRCROOT}/manifests/cluster-install" >> "${SRCROOT}/manifests/install.yaml"
update_image "${SRCROOT}/manifests/install.yaml"

echo "${AUTOGENMSG}" > "${SRCROOT}/manifests/namespace-install.yaml"
kustomize build "${SRCROOT}/manifests/namespace-install" >> "${SRCROOT}/manifests/namespace-install.yaml"
update_image "${SRCROOT}/manifests/namespace-install.yaml"
2 changes: 0 additions & 2 deletions manifests/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
resources:
- application-crd.yaml
- appproject-crd.yaml
- argocd-cm.yaml
- argocd-secret.yaml
- argocd-rbac-cm.yaml
Expand Down
2 changes: 1 addition & 1 deletion manifests/cluster-install/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bases:
- ../base
- ../namespace-install

resources:
- application-controller-clusterrole.yaml
Expand Down
3 changes: 3 additions & 0 deletions manifests/crds/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resources:
- application-crd.yaml
- appproject-crd.yaml
3 changes: 3 additions & 0 deletions manifests/namespace-install/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bases:
- ../crds
- ../base
2 changes: 1 addition & 1 deletion reposerver/repository/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func TestGenerateYamlManifestInDir(t *testing.T) {
// update this value if we add/remove manifests
const countOfManifests = 23
const countOfManifests = 21

q := ManifestRequest{
ApplicationSource: &argoappv1.ApplicationSource{},
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/fixture.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func getFreePort() (int, error) {
}

func (f *Fixture) setup() error {
_, err := exec.Command("kubectl", "apply", "-f", "../../manifests/base/application-crd.yaml", "-f", "../../manifests/base/appproject-crd.yaml").Output()
_, err := exec.Command("kubectl", "apply", "-f", "../../manifests/crds/application-crd.yaml", "-f", "../../manifests/crds/appproject-crd.yaml").Output()
if err != nil {
return err
}
Expand Down