This a MVP for a global library that will configure artifactory and customtools post install as a job.
This can live as a global variable in /vars of your global pipeline. If this file was config.groovy you
can call these functions as config.artifactory()
See below how to wire the global lib into casc
import hudson.tools.*
import jenkins.model.*
import com.cloudbees.jenkins.plugins.customtools.*
import com.synopsys.arc.jenkinsci.plugins.customtools.versions.ToolVersionConfig
import org.jfrog.* 
import org.jfrog.hudson.* 
import org.jfrog.hudson.util.Credentials;
// This uses an artifactory credential, I recommend bringing the credential in through the normal pipeline
// process "withCredentials" and substituting.
// constructor variables:
// serverId (string)
// artifactoryURL (string)
// deployerCredentialsConfig (CredentialsConfig)
// resolverCredentialsConfig (CredentialsConfig)
// timeout (int)
// bypassProxy (bool)
// connectionRetry (int)
// deploymentThreads(int)
def artifactory() {
    def inst = Jenkins.getInstance()
    def desc = inst.getDescriptor("org.jfrog.hudson.ArtifactoryBuilder")
    def deployerCredentials = new CredentialsConfig("<username>", "<password>", "")
    def sinst = [new ArtifactoryServer( 
    "Artifactory", 
    "https://demo-test.com/artifactory", 
    deployerCredentials,deployerCredentials,
    300, 
    true ,1,1)]
    
    desc.setArtifactoryServers(sinst)
}
// zip extraction from url
def customtools_url () {
    def inst = Jenkins.getInstance()
    def desc = inst.getExtensionList(com.cloudbees.jenkins.plugins.customtools.CustomTool.DescriptorImpl.class)[0]
    def customTools = []
    List installers = new ArrayList();
    installers.add(new ZipExtractionInstaller("<label>", "<url>", "<dir>"))
    List<ToolProperty> properties = new ArrayList<ToolProperty>()
    properties.add(new InstallSourceProperty(installers))
    def installation = new CustomTool(
    "<toolname>",
    "",
    properties,
    "",
    null,
    ToolVersionConfig.DEFAULT,
    null
    )
    customTools.push(installation)
    desc.setInstallations((com.cloudbees.jenkins.plugins.customtools.CustomTool[]) customTools)
    desc.save()
}
// run bash
def customtools_sh () {
    def inst = Jenkins.getInstance()
    def desc = inst.getExtensionList(com.cloudbees.jenkins.plugins.customtools.CustomTool.DescriptorImpl.class)[0]
    def customTools = []
    List installers = new ArrayList();
    installers.add(new CommandInstaller("<label>", "<command>", "<dir>")
    List<ToolProperty> properties = new ArrayList<ToolProperty>()
    properties.add(new InstallSourceProperty(installers))
    def installation = new CustomTool(
    "<toolname>",
    "",
    properties,
    "",
    null,
    ToolVersionConfig.DEFAULT,
    null
    )
    customTools.push(installation)
    desc.setInstallations((com.cloudbees.jenkins.plugins.customtools.CustomTool[]) customTools)
    desc.save()
}Change the Github piece to Bitbucket branch Source
globalLibraries:
    libraries:
    - defaultVersion: "master"
      implicit: true
      name: "shlib"
      retriever:
        modernSCM:
          scm:
            github:
              configuredByUrl: true
              credentialsId: "github-user-token"
              id: "d4b4d948-b7ff-4b86-9909-a948a629a555"
              repoOwner: "initrode"
              repository: "shared-marker"
              repositoryUrl: "https://github.com/initrode/shared-marker.git"
              traits:
              - gitHubBranchDiscovery:
                  strategyId: 1
              - gitHubPullRequestDiscovery:
                  strategyId: 1
              - gitHubForkDiscovery:
                  strategyId: 1
                  trust: "gitHubTrustPermissions"https://jenkinsci.github.io/job-dsl-plugin/
Create a pipeline job that can take advantage of the shared library. You can use a cron trigger to automatically run the job when the master comes up
https://jenkinsci.github.io/job-dsl-plugin/#path/pipelineJob
Triggers:
properties([pipelineTriggers([cron('H 23 * * *')])])
or (declaritive):
triggers {
    cron('H */4 * * 1-5')
}