We are trying to manage a CI/CD pipeline to check,test and deploy a set of BigQuery UDFs. As far as I got, storing UDFs as module on google cloud storage and version them should be the way to do. Currently we are using nodejs to test them (locally) and build a single file library using webpack. Our approach lacks of versioning, because we couldn't find a place to specify the version of the file stored in Google Storage used as UDF library. See the block below as example.
CREATE OR REPLACE FUNCTION myFunc(a FLOAT64, b STRING)
RETURNS STRING
LANGUAGE js
OPTIONS (
library=['gs://my-bucket/path/to/ourlib.js'])
AS r"""
// Assumes 'doInterestingStuff' is defined in one of the library files.
return doInterestingStuff(a, b);
""";
Which is the best way to work with UDFs in a CI/CD context? Is there any repository where we can find a proper way to maintain a core UDF library handled as pure javascript (without the inner "CREATE FUNCTION") with a test suite and a deployment phase? How would I version it properly? In our case everything is handled within a Dataform project.