reusing logic from jenkins job