codeamp / circuit

CodeAmp API. Built with Golang, GraphQL, GORM and Socket-IO
Apache License 2.0
21 stars 6 forks source link

Add export functionality for project configuration #432

Open drshrey opened 5 years ago

drshrey commented 5 years ago

This addresses part 1 of 2 for supporting project configurations. This commit allows projects to be exported in a YAML format and also introduces the concept of a ResourceConfig.

An example of an exported project config:

settings:
  gitBranch: master
  continuousDeploy: true
extensions:
  - customConfig: '{}'
    config: |
      []
    key: githubstatus
  - customConfig: '{}'
    config: |
      []
    key: dockerbuilder
  - customConfig: '{}'
    config: |
      []
    key: 'kubernetes:deployment'
  - customConfig: '{}'
    config: |
      - source: ""
        key: WEBHOOK_URL
        value: https://hooks.slack.com/...
        secret: false
      - source: ""
        key: CHANNEL
        value: '#devops-test'
        secret: false
    key: slack
  - customConfig: >-
      {"type": "loadbalancer", "ingress":
      "...",
      "service": "www:80", "protocol": "TCP", "subdomain": "",
      "upstream_domains": [{"apex": "...", "subdomain":
      "deploy-test"}, {"apex": "...", "subdomain": "deploy-test"}]}
    config: |
      []
    key: 'kubernetes:ingressroute'
  - customConfig: >-
      {"subdomain": "deploy-test", "loadbalancer":
      "...",
      "loadbalancer_fqdn":
      "...",
      "loadbalancer_type": "loadbalancer"}
    config: |
      []
    key: route53
secrets:
  - key: ENV_TEST
    value: test
    type: env
    isSecret: false
  - key: secrets-test.txt
    value: 'Hi, I am a secret. Please test for my presence!'
    type: file
    isSecret: false
  - key: WEBHOOK_URL
    value: ...
    type: env
    isSecret: true
services:
  - service:
      command: echo hello & exit
      name: 'true'
      type: one-shot
      count: 0
      servicePorts: []
      deploymentStrategy:
        type: ''
        maxUnavailable: 0
        maxSurge: 0
      readinessProbe:
        type: ''
        method: ''
        command: ''
        port: 0
        scheme: ''
        path: ''
        httpHeaders: []
        initialDelaySeconds: 0
        periodSeconds: 0
        timeoutSeconds: 0
        successThreshold: 0
        failureThreshold: 0
      livenessProbe:
        type: ''
        method: ''
        command: ''
        port: 0
        scheme: ''
        path: ''
        httpHeaders: []
        initialDelaySeconds: 0
        periodSeconds: 0
        timeoutSeconds: 0
        successThreshold: 0
        failureThreshold: 0
      preStopHook: ''
  - service:
      command: echo hello & exit
      name: 'true'
      type: one-shot
      count: 0
      servicePorts: []
      deploymentStrategy:
        type: ''
        maxUnavailable: 0
        maxSurge: 0
      readinessProbe:
        type: ''
        method: ''
        command: ''
        port: 0
        scheme: ''
        path: ''
        httpHeaders: []
        initialDelaySeconds: 0
        periodSeconds: 0
        timeoutSeconds: 0
        successThreshold: 0
        failureThreshold: 0
      livenessProbe:
        type: ''
        method: ''
        command: ''
        port: 0
        scheme: ''
        path: ''
        httpHeaders: []
        initialDelaySeconds: 0
        periodSeconds: 0
        timeoutSeconds: 0
        successThreshold: 0
        failureThreshold: 0
      preStopHook: ''
  - service:
      command: echo hello & exit
      name: 'true'
      type: one-shot
      count: 0
      servicePorts: []
      deploymentStrategy:
        type: ''
        maxUnavailable: 0
        maxSurge: 0
      readinessProbe:
        type: ''
        method: ''
        command: ''
        port: 0
        scheme: ''
        path: ''
        httpHeaders: []
        initialDelaySeconds: 0
        periodSeconds: 0
        timeoutSeconds: 0
        successThreshold: 0
        failureThreshold: 0
      livenessProbe:
        type: ''
        method: ''
        command: ''
        port: 0
        scheme: ''
        path: ''
        httpHeaders: []
        initialDelaySeconds: 0
        periodSeconds: 0
        timeoutSeconds: 0
        successThreshold: 0
        failureThreshold: 0
      preStopHook: ''
  - service:
      command: echo hello & exit
      name: 'true'
      type: one-shot
      count: 0
      servicePorts: []
      deploymentStrategy:
        type: ''
        maxUnavailable: 0
        maxSurge: 0
      readinessProbe:
        type: ''
        method: ''
        command: ''
        port: 0
        scheme: ''
        path: ''
        httpHeaders: []
        initialDelaySeconds: 0
        periodSeconds: 0
        timeoutSeconds: 0
        successThreshold: 0
        failureThreshold: 0
      livenessProbe:
        type: ''
        method: ''
        command: ''
        port: 0
        scheme: ''
        path: ''
        httpHeaders: []
        initialDelaySeconds: 0
        periodSeconds: 0
        timeoutSeconds: 0
        successThreshold: 0
        failureThreshold: 0
      preStopHook: ''
  - service:
      command: echo hello & exit
      name: 'true'
      type: one-shot
      count: 0
      servicePorts: []
      deploymentStrategy:
        type: ''
        maxUnavailable: 0
        maxSurge: 0
      readinessProbe:
        type: ''
        method: ''
        command: ''
        port: 0
        scheme: ''
        path: ''
        httpHeaders: []
        initialDelaySeconds: 0
        periodSeconds: 0
        timeoutSeconds: 0
        successThreshold: 0
        failureThreshold: 0
      livenessProbe:
        type: ''
        method: ''
        command: ''
        port: 0
        scheme: ''
        path: ''
        httpHeaders: []
        initialDelaySeconds: 0
        periodSeconds: 0
        timeoutSeconds: 0
        successThreshold: 0
        failureThreshold: 0
      preStopHook: ''
codecov[bot] commented 5 years ago

Codecov Report

Merging #432 into master will decrease coverage by 0.17%. The diff coverage is 50%.

@@            Coverage Diff             @@
##           master     #432      +/-   ##
==========================================
- Coverage   57.49%   57.31%   -0.18%     
==========================================
  Files          62       68       +6     
  Lines        6632     6790     +158     
==========================================
+ Hits         3813     3892      +79     
- Misses       2394     2459      +65     
- Partials      425      439      +14