This repository has been archived on 2024-10-01. You can view files and clone it, but cannot push or open issues or pull requests.
badhouseplants-net-old/content/posts/argocd-dynamic-environment-per-branch-part-2/index.md
Nikolai Rodionov 4e1fa24a21
feat: Add a script for pushing images to the bucket
build: Update the CI

fix: Update the sctipt so it creates correct dirs
2023-03-29 18:39:09 +02:00

1.7 KiB
Raw Blame History

title date draft ShowToc cover
Argocd Dynamic Environment per Branch Part 2 2023-03-29T17:31:20+02:00 true true
image caption relative responsiveImages
cover.png Argocd Dynamic Environment per Branch Part 2 false 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.

Im 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:

  - 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