solvaholic / octodns-sync

GitHub Action to test and deploy DNS settings with OctoDNS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support using unreleased versions of octodns

patcon opened this issue · comments

Re-ticketed from g0v-network/domains#20

There's a feature added to octodns last month to customize extension of config folders used in yamlsplitprovider. There hasn't been a release of octodns since last Nov.

Would you be willing to accept a PR for manually setting the octodns version, including commit references from git repo?

Thanks!

Hi @patcon 👋

Would you be willing to accept a PR for manually setting the octodns version, including commit references from git repo?

Yes, thank you for suggesting it!

The easy place I think of to add logic for it is in entrypoint.sh. However, I haven't looked into what it'd take to install a particular commit from octodns/octodns.

What do you have in mind?

Ok! Thanks for the pointer. For expediency, I actually just started using the same scripts I use locally, so kinda in a stable state rn. but will prob come back to this later ❤️

Support using unreleased versions of octodns

Currently solvaholic/octodns-sync runs a Docker container preloaded with a version of octodns and all the packages its providers may require.

To install unreleased octodns I think clone octodns/octodns at a specified ref then pip install octodns and the included requirements.txt. This adds about 45 seconds to each workflow job, on top of the docker pull time.

On the other hand, it only takes 45 seconds to install everything at run time. This action could stop using (or go back to not using) the Docker container, just install octodns and requirements on the Actions runner.

_ver="${{ github.event.inputs.version }}"
if [[ "$_ver" = v* ]]; then
  # Assume input 'version' is an available release
  curl -O "https://raw.githubusercontent.com/octodns/octodns/$_ver/requirements.txt"
  pip install "octodns==${_ver#v}" -r requirements.txt
else
  # Assume input 'version' is a Git ref in octodns/octodns
  git clone --single-branch --branch "$_ver" --no-tags \
  https://github.com/octodns/octodns.git ./octodns-src
  pip install ./octodns-sync -r ./octodns-src/requirements.txt
fi

That'd remove all the Docker and container dependencies, and shift the PyPI dependency from the release process (where the container is built) to the workflow job run. All while adding agility, sounds good to me.

Regarding the extra 20 seconds or so running on the runner adds compared to pulling the container for the current release, that can be eliminated by more efficient package selection.

This action could stop using (or go back to not using) the Docker container, just install octodns and requirements on the Actions runner.

I wrote that ☝️ up in #53, which is available to test from a workflow with:

        uses: solvaholic/octodns-sync@issue50

Currently the octodns_ref input value must be a valid Git ref in octodns/octodns. For example v0.9.12 or master.

I'll test some more to make sure --doit still works, and add_pr_comment functions as it does currently in @main. Unless there's a reason to wait I'd like to merge #53 and cut a v2.2.0 release in this repo around 08 May.

@patcon I think #53 gets what you had asked about:

manually setting the octodns version, including commit references

Now you can provide a branch or tag name, through the octodns_ref input, using @main.

A different approach would be required, I think, to use octodns from a particular commit SHA. If that's something you have a need for, or if you see more to address in this issue, please do re-open it 🙇

Thanks again for suggesting this!