---
title: "Argocd Dynamic Environment per Branch Part 2"
date: 2023-03-29T17:31:20+02:00
draft: true
ShowToc: true
cover:
    image: "cover.png"
    caption: "Argocd Dynamic Environment per Branch Part 2"
    relative: false
    responsiveImages: false
---

So it's been a while since the last post. And I'd like to continue the topic, because I've updated some things. But at the same time I'd like to talk about the setup that I've got and why I think it is good. 

First, I'd like to show how I fixed the Minio issue from the previous post. 

>I’m using Minio as a storage for pictures, and currently all pictures (and other files) are stored in one folder regardless of the environment.

I've started using `git lfs` for media data. But I still want to have small docker images so I've decided to add some logi around pushing media files to `Minio`. So I've added a Drone job:
```YAML
  - name: Sync pictures from lfs to Minio
    image: rclone/rclone:latest
    when:
      branch:
        exclude:
          - main
    environment:
      RCLONE_CONFIG_CONTENT:
        from_secret: RCLONE_CONFIG_CONTENT_PRIVATE
      RCLONE_CONFIG: /tmp/rclone.conf
    commands:
      - echo "$RCLONE_CONFIG_CONTENT" > $RCLONE_CONFIG
      - apk update
      - apk add git make
      - make upload_static

  - name: Sync pictures to the main Minio bucket
    image: rclone/rclone:latest
    when:
      branch:
        - main
    environment:
      RCLONE_CONFIG_CONTENT:
        from_secret: RCLONE_CONFIG_CONTENT_PRIVATE
      RCLONE_CONFIG: /tmp/rclone.conf
    commands:
      - echo "$RCLONE_CONFIG_CONTENT" > $RCLONE_CONFIG
      - apk update
      - apk add git make
      - make sync_static_with_main
```


