Try syncing
This commit is contained in:
		
							
								
								
									
										10
									
								
								.drone.yml
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								.drone.yml
									
									
									
									
									
								
							@@ -65,6 +65,16 @@ steps:
 | 
			
		||||
    - yq '.spec.generators[].list.elements += load("/tmp/elements.yaml")' /tmp/clean_appset.yaml > /tmp/new_appset.yaml
 | 
			
		||||
    - kubectl apply -f /tmp/new_appset.yaml
 | 
			
		||||
 | 
			
		||||
- name: Sync application 
 | 
			
		||||
  image: argoproj/argocd
 | 
			
		||||
  environment:
 | 
			
		||||
    ARGOCD_SERVER: 
 | 
			
		||||
      from_secret: ARGOCD_SERVER
 | 
			
		||||
    ARGOCD_AUTH_TOKEN:
 | 
			
		||||
      from_secret: ARGOCD_AUTH_TOKEN
 | 
			
		||||
  commands:
 | 
			
		||||
    - argocd app sync -l app=badhouseplants -l branch=$DRONE_BRANCH
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
# ----------------------------------------------
 | 
			
		||||
# -- Upload a newer version of my CV
 | 
			
		||||
 
 | 
			
		||||
@@ -342,6 +342,35 @@ So my pipeline for a non-main branch looks like that:
 | 
			
		||||
    - kubectl apply -f /tmp/new_appset.yaml
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
And even though it's very ugly, I already like it. Because it's working
 | 
			
		||||
And even though it's very ugly, I already like it. Because it works.
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
I would like to move the whole pipeline logic out of the `.drone.yml` file. But I will do it later.
 | 
			
		||||
 | 
			
		||||
After our application set is deployed, we need to update the application the is created by it. I would like to use the `argocd` cli tool for that. to sync one app we need to use selectors, and I'd like to go with labels. So let's first add labels to our `ApplicationSet`
 | 
			
		||||
 | 
			
		||||
```YAML
 | 
			
		||||
...
 | 
			
		||||
  template:
 | 
			
		||||
    metadata:
 | 
			
		||||
      name: "{{ app }}-{{ name }}"
 | 
			
		||||
      namespace: argo-system
 | 
			
		||||
      labels:
 | 
			
		||||
        branch: "{{ name }}"
 | 
			
		||||
        application: "{{ app }}"
 | 
			
		||||
...
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
And now let's create a job like that:
 | 
			
		||||
```YAML
 | 
			
		||||
- name: Sync application 
 | 
			
		||||
  image: argoproj/argocd
 | 
			
		||||
  environment:
 | 
			
		||||
    ARGOCD_SERVER: 
 | 
			
		||||
      from_secret: ARGOCD_SERVER
 | 
			
		||||
    ARGOCD_AUTH_TOKEN:
 | 
			
		||||
      from_secret: ARGOCD_AUTH_TOKEN
 | 
			
		||||
  commands:
 | 
			
		||||
    - argocd app sync -l app=badhouseplants -l branch=$DRONE_BRANCH
 | 
			
		||||
```
 | 
			
		||||
@@ -5,25 +5,15 @@ metadata:
 | 
			
		||||
  namespace: argo-system
 | 
			
		||||
spec:
 | 
			
		||||
  generators:
 | 
			
		||||
    - list:
 | 
			
		||||
        elements:
 | 
			
		||||
          - name: dynamic-charts
 | 
			
		||||
            app: badhouseplants
 | 
			
		||||
            branch: dynamic-charts
 | 
			
		||||
            chart_version: 0.3.6
 | 
			
		||||
            value: |
 | 
			
		||||
              istio:
 | 
			
		||||
                hosts:
 | 
			
		||||
                  - dynamic-charts-dev.badhouseplants.net
 | 
			
		||||
              hugo:
 | 
			
		||||
                image:
 | 
			
		||||
                  tag: 5d742a71731320883db698432303c92aee4d68a1
 | 
			
		||||
                baseURL: https://dynamic-charts-dev.badhouseplants.net/
 | 
			
		||||
                buildDrafts: true
 | 
			
		||||
    - list: 
 | 
			
		||||
        elements: []
 | 
			
		||||
  template:
 | 
			
		||||
    metadata:
 | 
			
		||||
      name: "{{ app }}-{{ name }}"
 | 
			
		||||
      namespace: argo-system
 | 
			
		||||
      labels:
 | 
			
		||||
        branch: "{{ name }}"
 | 
			
		||||
        application: "{{ app }}"
 | 
			
		||||
    spec:
 | 
			
		||||
      project: "default"
 | 
			
		||||
      source:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user