{"id":21748356,"url":"https://github.com/surfstudio/jenkins-pipeline-lib","last_synced_at":"2026-05-10T14:42:51.716Z","repository":{"id":53747561,"uuid":"152079092","full_name":"surfstudio/jenkins-pipeline-lib","owner":"surfstudio","description":"Библиотека для pipeline скриптов Jenkins студии Surf","archived":false,"fork":false,"pushed_at":"2021-04-05T17:29:16.000Z","size":22527,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":33,"default_branch":"version-3.0.0-SNAPSHOT","last_synced_at":"2025-03-21T02:25:19.878Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://bitbucket.org/surfstudio/jenkins-pipeline-lib/","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/surfstudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-08T12:49:54.000Z","updated_at":"2024-03-04T12:52:20.000Z","dependencies_parsed_at":"2022-09-10T08:51:52.020Z","dependency_job_id":null,"html_url":"https://github.com/surfstudio/jenkins-pipeline-lib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/surfstudio/jenkins-pipeline-lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fjenkins-pipeline-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fjenkins-pipeline-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fjenkins-pipeline-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fjenkins-pipeline-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/surfstudio","download_url":"https://codeload.github.com/surfstudio/jenkins-pipeline-lib/tar.gz/refs/heads/version-3.0.0-SNAPSHOT","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fjenkins-pipeline-lib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32860226,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-10T13:40:02.631Z","status":"ssl_error","status_checked_at":"2026-05-10T13:40:02.145Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-26T08:13:10.531Z","updated_at":"2026-05-10T14:42:51.692Z","avatar_url":"https://github.com/surfstudio.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jenkins-pipeline-lib\n[Библиотека](https://jenkins.io/doc/book/pipeline/shared-libraries/) для pipeline скриптов Jenkins студии [Surf](https://surfstudio.ru/)\n\nСодержит: \n\n* Базовые классы для удобной работы со scripted pipeline\n* Готовые pipelines для внутреннего процесса Surf\n* Утилиты для распростаненных задач ci разработки Android и iOS приложений\n\n\n Наследники класса Pipeline - ключевые сущности для выполнения скрипта\n По сути знают что и как выполнять и определяют параметры выполнения\n \n * \"как\" определяется методом run (не нужно переопределять)\n * \"что\" определяется в методе init (нужно переопределять)\n * \"параметры выполнения\" определяются через публичные переменные\n \n Для создания собственного наследника необходимо переопределить метод init и в нем определенить переменные\n (любая из них может быть не проинициализирована):\n \n * **node**                  :  Машина, на которой будет выполняться основная работа(stages)\n * **stages**                :  Массив с обьектами определяющими блоки основной работы\n * **initializeBody**        :  Лямбда, котороая будет выполняться перед стартом основной работы на master машине\n * **finalizeBody**          :  Лямбда, которая будет выполняться после основной работы, как в случае успешного завершения, так и после ошибки\n * **propertiesProvider**    :  Лямбда, которая должна вернуть массив properties, например триггеры и параметры сборки\n * **preExecuteStageBody**   :  Лямбда, которая выполняется до выполнения Stage\n * **postExecuteStageBody**  :  Лямбда, которая выполняется после выполнения Stage\n\nПредусмотрены различные способы кастомизации\n\n * изменение переменных, определяющих контекст\n * изменение стратегии/тела Stage (для получения следует использовать getStage())\n * замена целых Stage через метод replaceStage() или напрямую через переменную stages\n * все остальное, что может прийти в голову, так как все переменные публичные\n\n Большую часть деталей реализации следует размещать в классах ...Util для возможности переиспользования\n без механизмов класса Pipeline\n\nПредусмотрен класс EmptyPipeline для полостью кастомных скриптов\n\nПример импользования:\n```groovy\n@Library('surf-lib@version-1.0.0-SNAPSHOT')\nimport ru.surfstudio.ci.pipeline.tag.TagPipelineAndroid\nimport ru.surfstudio.ci.stage.StageStrategy\nimport ru.surfstudio.ci.AndroidUtil\n\n//init\ndef pipeline = new TagPipelineAndroid(this)\npipeline.init()\n\n//customization\npipeline.buildGradleTask = \"clean assembleQa\"\npipeline.getStage(pipeline.STATIC_CODE_ANALYSIS).strategy = StageStrategy.SKIP_STAGE\npipeline.getStage(pipeline.INSTRUMENTATION_TEST).body = {\n\tAndroidUtil.onEmulator(this, \"your avd\") {\n\t\tsh \"./gradlew connectedTest\"\n\t}\n}\n\n//run\npipeline.run()\n```\n\n### Шаблоны\nВ папке templates находятся стандартные Jenkins скрипты для разных типов проектов (android, ios, ui_test)\n\n# Разработка\nОсновными ветками являются ветки вида **version-X.Y.Z-SNAPSHOT**\nИзменение библиотеки следует производить в feature-branch, чтобы не затронуть работающие проекты. Когда новая функциональность будет закончена, следует слить ветку с ней в master. \nДля тестирования изменений в пайплайн скрипте следует импортировать библиотеку следующим образом `@Library('surf-lib@feature-branch')`. Не забываем поддерживать обратную совместимость Api библиотеки.\n### Инструменты\nДля работы с библиотекой удобно использовать [IntelliJ IDEA](https://www.jetbrains.com/idea/) c установленным [Groovy](http://groovy-lang.org/install.html).\nВ ProjectStructure на вкладке Modules директорию \"src\" следует пометить как \"Sources\" \n\n# Кофигурация Jenkins\n* Версия Jenkins \u003e= 2.121.2\n* nodes для Android сборок с меткой \"android\"\n* nodes для iOS сборок с меткой \"ios\"\n* ui test (todo)\n\n### Необходимые плагины\n* Blue Ocean\n* Build Pipeline Plugin\n* Pipeline\n* Pipeline Utility Steps\n* Generic Webhook Trigger\n* Git plugin\n* JUnit Attachments Plugin\n* Poll SCM plugin\n* [Bitbucket Build Status Notifier Plugin](https://github.com/surfstudio/bitbucket-build-status-notifier-plugin) surf fork\n* [GitLab Build Status Notifier Plugin](https://github.com/surfstudio/gitlab-plugin) surf fork\n\n\n### Конфигурация Job\nДля большинства случаев используются jeninsFile (см пакет templates), размещенные в репозитории с исходным кодом.\n#### Пример начальной конфигурации Job для сборки PullRequest из BitBucket (остальная конфигурация применится из pipeline при первом старте job):\n![TemplateJobPr](images/TemplateJobPr.png)\n\n* Repository URL - репозиторий с jenkinsFile  \n* Script Path - путь до jenkinsFile\n\nТакже необходим вебхук на события \"Pull Request - Created: true; Updated: true\" в Bitbucket c URL: http://jenkins.surfstudio.ru/generic-webhook-trigger/invoke?token=Your_token_for_trigger_build_remotely \n\n## License\n```\n  Copyright (c) 2018-present, SurfStudio LLC.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurfstudio%2Fjenkins-pipeline-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsurfstudio%2Fjenkins-pipeline-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurfstudio%2Fjenkins-pipeline-lib/lists"}