Skip to content

GitHub Action to test and deploy DNS settings with octodns

License

Notifications You must be signed in to change notification settings

travislikestocode/octodns-sync

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

octodns-sync

This action runs octodns-sync from octodns/octodns to deploy your DNS config to any cloud.

octodns allows you to manage your DNS records in a portable format and publish changes across different DNS providers. It is extensible and customizable.

When you manage your octodns DNS configuration in a GitHub repository, this GitHub Action allows you to test and publish your changes automatically using a workflow you define.

Example workflow

name: octodns-sync

on:
  # Deploy config whenever DNS changes are pushed to main.
  push:
    branches:
      - main
    paths:
      - '*.yaml'

env:
  AWS_ACCESS_KEY_ID: ${{ secrets.route53_aws_key_id }}
  AWS_SECRET_ACCESS_KEY: ${{ secrets.route53_aws_secret_access_key }}

jobs:
  publish:
    name: Publish DNS config from main
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2
      - name: Publish
        uses: solvaholic/octodns-sync@main
        with:
          config_path: public.yaml
          doit: '--doit'

Inputs

Secrets

To authenticate with your DNS provider, this action uses encrypted secrets you've configured on your repository. For example, if you use Amazon Route53, create these secrets on the repository where you store your DNS configuration:

"route53-aws-key-id": "YOURIDGOESHERE"
"route53-aws-secret-access-key": "YOURKEYGOESHERE"

Then include them as environment variables in your workflow. For example:

env:
  AWS_ACCESS_KEY_ID: ${{ secrets.route53-aws-key-id }}
  AWS_SECRET_ACCESS_KEY: ${{ secrets.route53-aws-secret-access-key }}

config_path

Path, relative to your repository root, of the config file you would like octodns to use.

Default "public.yaml".

doit

Really do it? Set "--doit" to do it; Any other string to not do it.

Default "" (empty string).

add_pr_comment

Add plan as a comment, when triggered by a pull request? Set "Yes" to do it.

Default "No".

If you would like to add the plan octodns-sync generates as a pull request comment, be sure to also read Add pull request comment below.

pr_comment_token

Provide a token to use, if you set add_pr_comment to "Yes".

Default "Not set".

octodns_ref

Select a release tag or a branch of octodns to use. For example "v0.9.12" or "awesome-feature".

Default "v0.9.12".

Outputs

octodns-sync will compare your configuration file to the configurations your providers have, and report any planned changes. The command logs this output in the workflow run log.

That same output is saved to $GITHUB_WORKSPACE/octodns-sync.log.

If you have configured plan_outputs for octodns, PlanHtml or PlanMarkdown output will be written to $GITHUB_WORKSPACE/octodns-sync.plan.

Add pull request comment

If you would like this action to add the octodns-sync plan to a pull request comment, configure plan_outputs in your octodns configuration, for example public.yml:

manager:
  plan_outputs:
    html:
      class: octodns.provider.plan.PlanHtml

Then configure your workflow to run this action on the pull_request event, set add_pr_comment to "Yes", and provide an API token. For example:

on:
  pull_request:
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: solvaholic/octodns-sync@latest
        with:
          config_path: public.yaml
          add_pr_comment: 'Yes'
          pr_comment_token: '${{ github.token }}'

About

GitHub Action to test and deploy DNS settings with octodns

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 86.3%
  • Makefile 13.7%