8
n8n 한국어amn8n.com

n8n 워크플로우 자동 일일 백업至 GitLab 저장소

고급

이것은Engineering, DevOps분야의자동화 워크플로우로, 19개의 노드를 포함합니다.주로 N8n, Set, Code, Gitlab, Switch 등의 노드를 사용하며. n8n 워크플로우를 통한 GitLab 저장소로의 자동 일일 백업

사전 요구사항
  • GitLab Personal Access Token
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
  "meta": {
    "instanceId": "7d8066d2f56a07000fe7d753d3eeabf0ecdf68413466f30d10afe0906f058427",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "91bb5db7-0bd4-4a17-859a-672515048d9e",
      "name": "전역",
      "type": "n8n-nodes-base.set",
      "position": [
        -2060,
        205.5
      ],
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "repo.owner",
              "stringValue": "={{ $json.owner.username }}"
            },
            {
              "name": "repo.name",
              "stringValue": "={{ $json.name }}"
            },
            {
              "name": "repo.branch",
              "stringValue": "={{ $json.default_branch }}"
            },
            {
              "name": "repo.path",
              "stringValue": "={{ $json.web_url }}"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "b8ed50c3-3b78-428a-997b-9efc109df984",
      "name": "결과",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -1400,
        5.5
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "04b6d718-d3bd-481c-8b7b-5b1188df2edf",
      "name": "현재 워크플로우",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -1400,
        205.5
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "5db89b68-76d1-461d-a49b-955373359830",
      "name": "워크플로우 순회",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1620,
        205.5
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "8944cbfa-e659-4683-a11f-c3510d0b34dc",
      "name": "파일 가져오기",
      "type": "n8n-nodes-base.gitlab",
      "onError": "continueErrorOutput",
      "position": [
        -1180,
        205.5
      ],
      "parameters": {
        "owner": "={{ $('Globals').first().json.repo.owner }}",
        "filePath": "={{ $json.id }}.json",
        "resource": "file",
        "operation": "get",
        "repository": "={{ $('Globals').first().json.repo.name }}",
        "binaryPropertyName": "file-from-gitlab",
        "additionalParameters": {
          "reference": "={{ $('Globals').first().json.repo.branch }}"
        }
      },
      "credentials": {
        "gitlabApi": {
          "id": "6NLmdaoq2NsT324y",
          "name": "GitLab account"
        }
      },
      "executeOnce": true,
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "id": "10f24280-16ce-406c-b5fe-2d715ed66b0c",
      "name": "파일 상태",
      "type": "n8n-nodes-base.code",
      "position": [
        -520,
        205.5
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "var item = $json;\n\n// Check first if is error\nif (item.error) {\n  if (\"The resource you are requesting could not be found\" == item.error) {\n    item[\"status\"] = \"new\";\n  } else {\n    item[\"status\"] = \"error\";\n  }\n  return $input.item;\n}\n\n// If not error check file with saved version\nvar workflowFromN8n = item[\"workflow-from-n8n\"];\nvar workflowFromGitlab = item[\"workflow-from-gitlab\"];\nvar areEquals = objectsAreEquals(workflowFromN8n, workflowFromGitlab);\n\nif (areEquals) {\n  item[\"status\"] = \"same\";\n} else {\n  item[\"status\"] = \"diff\";\n}\n\n// Return Item\nreturn item;\n\n/**\n * Compare to objects\n * @param object1 \n * @param object2 \n * @returns true if the are the same without ignored fields\n */\nfunction objectsAreEquals(object1, object2) {\n  const objectKeys1 = Object.keys(object1);\n  const objectKeys2 = Object.keys(object2);\n\n  // If the numbers of fields are differents, the objects are differents\n  if (objectKeys1.length !== objectKeys2.length) {\n    return false;\n  }\n  for (const key of objectKeys1) {\n    // Define some fields to be ignored\n    var ignoreCurrent = false;\n    switch (key) {\n      case \"updatedAt\": // Changed because workflow change... not usefull\n      case \"global\": // changed for running reasons, no need to check\n        ignoreCurrent = true;\n    }\n\n    // If it's not an ignored field\n    if (!ignoreCurrent) {\n      const value1 = object1[key];\n      const value2 = object2[key];\n      const isBothAreObjects = isObject(value1) && isObject(value2);\n\n      // If it's objects recursive check\n      if (isBothAreObjects && !objectsAreEquals(value1, value2)) {\n        return false;\n      }\n\n      // If it's not objects, just compare values\n      if (!isBothAreObjects && value1 != value2) {\n        return false;\n      }\n    }\n  }\n  return true;\n}\n\n/**\n * Tool function to determine if an parameter is an object\n * @param object \n * @returns \n */\nfunction isObject(object) {\n  return object !== null && typeof object === \"object\";\n}\n"
      },
      "typeVersion": 2
    },
    {
      "id": "548ae4ec-3d45-4880-a9a0-2abe48831e88",
      "name": "상태 오류",
      "type": "n8n-nodes-base.set",
      "position": [
        140,
        80.5
      ],
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "name",
              "stringValue": "={{ $('Current workflow').item.json.name }}"
            },
            {
              "name": "status",
              "stringValue": "=Error : {{ $json.error }}"
            }
          ]
        },
        "include": "none",
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "06b4fe3e-ca4b-4ad5-a2dc-ca68ac74e7e5",
      "name": "순회 종료",
      "type": "n8n-nodes-base.noOp",
      "position": [
        360,
        370
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1b5df0b1-9f85-422c-9ad7-4020086d49a1",
      "name": "파일 생성",
      "type": "n8n-nodes-base.gitlab",
      "onError": "continueErrorOutput",
      "position": [
        -80,
        -119.5
      ],
      "parameters": {
        "owner": "={{ $('Globals').first().json.repo.owner }}",
        "branch": "={{ $('Globals').first().json.repo.branch }}",
        "filePath": "={{ $json.id }}.json",
        "resource": "file",
        "repository": "={{ $('Globals').first().json.repo.name }}",
        "fileContent": "={{ JSON.stringify($('Current workflow').item.json, null, 4) }}",
        "commitMessage": "=Create file for workflow {{ $('Current workflow').item.json.name }}",
        "additionalParameters": {
          "author": {
            "name": "n8n",
            "email": "akhil@nuevesolutions.com"
          }
        }
      },
      "credentials": {
        "gitlabApi": {
          "id": "6NLmdaoq2NsT324y",
          "name": "GitLab account"
        }
      },
      "executeOnce": true,
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "id": "06c2150b-491c-4b44-9b43-88b1e1df5793",
      "name": "파일에서 추출",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -960,
        105.5
      ],
      "parameters": {
        "options": {},
        "operation": "fromJson",
        "destinationKey": "workflow-from-gitlab",
        "binaryPropertyName": "file-from-gitlab"
      },
      "typeVersion": 1
    },
    {
      "id": "6a9b5a29-6874-433c-849a-97e37bfba40d",
      "name": "분기",
      "type": "n8n-nodes-base.switch",
      "position": [
        -300,
        184.5
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "new",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "9cd88022-6d97-409f-a37e-ae6b02b6269b",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "new"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "same",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "0ff6e053-e89d-49fa-b8c8-3a51ffe016d8",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "same"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "diff",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "b6b954c3-e74c-4f60-8e9e-ac79d4b741f3",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "diff"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra",
          "renameFallbackOutput": "error"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "84a7f4b9-b76e-41ee-8413-26fb095627a8",
      "name": "새 파일 버전",
      "type": "n8n-nodes-base.gitlab",
      "onError": "continueErrorOutput",
      "position": [
        -80,
        280.5
      ],
      "parameters": {
        "owner": "={{ $('Globals').first().json.repo.owner }}",
        "branch": "={{ $('Globals').first().json.repo.branch }}",
        "filePath": "={{ $json['workflow-from-n8n'].id }}.json",
        "resource": "file",
        "operation": "edit",
        "repository": "={{ $('Globals').first().json.repo.name }}",
        "fileContent": "={{ JSON.stringify($json['workflow-from-n8n'], null, 4) }}",
        "commitMessage": "=New file version for workflow {{ $json['workflow-from-n8n'].name }}"
      },
      "credentials": {
        "gitlabApi": {
          "id": "6NLmdaoq2NsT324y",
          "name": "GitLab account"
        }
      },
      "executeOnce": true,
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "id": "ec89cb60-e144-4b77-bea8-e32122a32ea1",
      "name": "오류 출력을 정상 출력으로",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -740,
        520
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f11d589b-ad66-4347-b9e8-6e56f003de5c",
      "name": "상태 다름",
      "type": "n8n-nodes-base.set",
      "position": [
        140,
        330.5
      ],
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "name",
              "stringValue": "={{ $('Current workflow').item.json.name }}"
            },
            {
              "name": "status",
              "stringValue": "diff"
            }
          ]
        },
        "include": "none",
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "67a1dfc1-f35e-4854-a61b-f9ba947d6371",
      "name": "상태 동일",
      "type": "n8n-nodes-base.set",
      "position": [
        140,
        530.5
      ],
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "name",
              "stringValue": "={{ $('Current workflow').item.json.name }}"
            },
            {
              "name": "status",
              "stringValue": "same"
            }
          ]
        },
        "include": "none",
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "d788fe7a-c713-426b-b15b-9e3fb806c8f4",
      "name": "모든 워크플로우 가져오기",
      "type": "n8n-nodes-base.n8n",
      "position": [
        -1840,
        205.5
      ],
      "parameters": {
        "filters": {},
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "id": "Hp7Xh2HuDWQAiZR6",
          "name": "n8n account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "19cd98bf-f055-43af-a86b-d0d77a331606",
      "name": "각 버전을 다른 필드에 저장",
      "type": "n8n-nodes-base.set",
      "position": [
        -740,
        105.5
      ],
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "workflow-from-gitlab",
              "type": "objectValue",
              "objectValue": "={{ $json['workflow-from-gitlab'] }}"
            },
            {
              "name": "workflow-from-n8n",
              "type": "objectValue",
              "objectValue": "={{ $('Current workflow').item.json }}"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "5b62ca2a-af1b-4d47-8750-526efe24949d",
      "name": "예약 트리거",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -2500,
        205.5
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e0db3d90-cdbe-4854-968c-2bde224dd759",
      "name": "GitLab",
      "type": "n8n-nodes-base.gitlab",
      "position": [
        -2280,
        205.5
      ],
      "parameters": {
        "owner": "{{change this to owner eg: akhil}}",
        "resource": "repository",
        "operation": "get",
        "repository": "n8n-workflows"
      },
      "credentials": {
        "gitlabApi": {
          "id": "6NLmdaoq2NsT324y",
          "name": "GitLab account"
        }
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "e0db3d90-cdbe-4854-968c-2bde224dd759": {
      "main": [
        [
          {
            "node": "91bb5db7-0bd4-4a17-859a-672515048d9e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6a9b5a29-6874-433c-849a-97e37bfba40d": {
      "main": [
        [
          {
            "node": "1b5df0b1-9f85-422c-9ad7-4020086d49a1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "67a1dfc1-f35e-4854-a61b-f9ba947d6371",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "84a7f4b9-b76e-41ee-8413-26fb095627a8",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "548ae4ec-3d45-4880-a9a0-2abe48831e88",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "91bb5db7-0bd4-4a17-859a-672515048d9e": {
      "main": [
        [
          {
            "node": "d788fe7a-c713-426b-b15b-9e3fb806c8f4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "06b4fe3e-ca4b-4ad5-a2dc-ca68ac74e7e5": {
      "main": [
        [
          {
            "node": "5db89b68-76d1-461d-a49b-955373359830",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8944cbfa-e659-4683-a11f-c3510d0b34dc": {
      "main": [
        [
          {
            "node": "06c2150b-491c-4b44-9b43-88b1e1df5793",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "ec89cb60-e144-4b77-bea8-e32122a32ea1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1b5df0b1-9f85-422c-9ad7-4020086d49a1": {
      "main": [
        [],
        [
          {
            "node": "548ae4ec-3d45-4880-a9a0-2abe48831e88",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "10f24280-16ce-406c-b5fe-2d715ed66b0c": {
      "main": [
        [
          {
            "node": "6a9b5a29-6874-433c-849a-97e37bfba40d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f11d589b-ad66-4347-b9e8-6e56f003de5c": {
      "main": [
        [
          {
            "node": "06b4fe3e-ca4b-4ad5-a2dc-ca68ac74e7e5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "67a1dfc1-f35e-4854-a61b-f9ba947d6371": {
      "main": [
        [
          {
            "node": "06b4fe3e-ca4b-4ad5-a2dc-ca68ac74e7e5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "548ae4ec-3d45-4880-a9a0-2abe48831e88": {
      "main": [
        [
          {
            "node": "06b4fe3e-ca4b-4ad5-a2dc-ca68ac74e7e5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "04b6d718-d3bd-481c-8b7b-5b1188df2edf": {
      "main": [
        [
          {
            "node": "8944cbfa-e659-4683-a11f-c3510d0b34dc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "84a7f4b9-b76e-41ee-8413-26fb095627a8": {
      "main": [
        [
          {
            "node": "f11d589b-ad66-4347-b9e8-6e56f003de5c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "548ae4ec-3d45-4880-a9a0-2abe48831e88",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5b62ca2a-af1b-4d47-8750-526efe24949d": {
      "main": [
        [
          {
            "node": "e0db3d90-cdbe-4854-968c-2bde224dd759",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "06c2150b-491c-4b44-9b43-88b1e1df5793": {
      "main": [
        [
          {
            "node": "19cd98bf-f055-43af-a86b-d0d77a331606",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5db89b68-76d1-461d-a49b-955373359830": {
      "main": [
        [
          {
            "node": "b8ed50c3-3b78-428a-997b-9efc109df984",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "04b6d718-d3bd-481c-8b7b-5b1188df2edf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d788fe7a-c713-426b-b15b-9e3fb806c8f4": {
      "main": [
        [
          {
            "node": "5db89b68-76d1-461d-a49b-955373359830",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ec89cb60-e144-4b77-bea8-e32122a32ea1": {
      "main": [
        [
          {
            "node": "10f24280-16ce-406c-b5fe-2d715ed66b0c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "19cd98bf-f055-43af-a86b-d0d77a331606": {
      "main": [
        [
          {
            "node": "10f24280-16ce-406c-b5fe-2d715ed66b0c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
자주 묻는 질문

이 워크플로우를 어떻게 사용하나요?

위의 JSON 구성 코드를 복사하여 n8n 인스턴스에서 새 워크플로우를 생성하고 "JSON에서 가져오기"를 선택한 후, 구성을 붙여넣고 필요에 따라 인증 설정을 수정하세요.

이 워크플로우는 어떤 시나리오에 적합한가요?

고급 - 엔지니어링, 데브옵스

유료인가요?

이 워크플로우는 완전히 무료이며 직접 가져와 사용할 수 있습니다. 다만, 워크플로우에서 사용하는 타사 서비스(예: OpenAI API)는 사용자 직접 비용을 지불해야 할 수 있습니다.

워크플로우 정보
난이도
고급
노드 수19
카테고리2
노드 유형9
난이도 설명

고급 사용자를 위한 16+개 노드의 복잡한 워크플로우

외부 링크
n8n.io에서 보기

이 워크플로우 공유

카테고리

카테고리: 34