Похожие чаты

There is a Jenkins pipeline job. It does the following


Stage 1. clones git repo.
Stage 2. Using matrix for multiple services.
- Prepare env variable stage
- run code linting
- run test
- build docker
- push image to ecr

Git repo have multiple services. We have to build and publish image to ecr for each service. I used matrix here and the variable is service_name with values service_a, service_b.

at prepare env step, variables I am creating by calling jenkins shared libs function. The jenkins shared libs function creates ecr_repo_name variable by concatenation of project_name, region and service_name.

Problem - the environment variables ecr_repo_name have the same value for all repos. So the image that is built is tagged wrong.

If I create this variable in the stage itself by not calling the jenkins shared lib function, it works.

One more thing... I am building docker image by using the shared libs function only.

How do I make it work using shared libs?
I have put in a lot of time in creating the shared libs function for each activity and now it does not work with matrix.

1 ответов

24 просмотра

It seems like you're facing an issue with Jenkins shared libraries when using them in a matrix. Shared libraries in Jenkins are a powerful tool for sharing Groovy code between different Jenkins jobs. They are stored in Git repositories, and their functionalities are at the user's disposal. The problem you're facing might be due to the scope of the variables in the shared library. When you're using a matrix, each axis of the matrix runs in its own environment, and changes to environment variables in one axis do not affect the others. This could be why the ecr_repo_name variable has the same value for all repos. Here are a few suggestions that might help: 1. Scope of Variables: Ensure that the variables you're defining in the shared library are not global. If they are, they might be getting overwritten in each run of the matrix. 2. Shared Library Structure: Verify that your shared library is structured correctly. The src directory should look like a standard Java source directory structure, and the vars directory should host script files that are exposed as a variable in Pipelines. 3. Library Loading: You might need to load the shared library in each stage of the matrix. This can ensure that the library and its functions are available in the scope of that stage. 4. Legacy SCM Option: Some users have reported that selecting the "Legacy SCM" option for shared libraries in the Jenkins -> Manage Jenkins -> Configure System menu resolved similar issues.

Похожие вопросы

Обсуждают сегодня

я не магистр хаскеля, но разве не может лейзи тип конвертнуться в не-лейзи запросив вычисление содержимого прям при инициализации?
deadgnom32 λ madao
100
Ребят такой вопрос я хочу пранк сделать в колледже и убрать все права установить 000 рекурсивно у домашней директории юзера, установить переменную окружения PATH в "" и сделат...
Super Sigma
21
Всем привет! Массив вводится с клавиатуры, кол-во элементов неизвестно, поэтому я указал arr db 100 dup(?) С нахождением максимума проблем нет, а вот минимум почему-то всегд...
En Vind Av Sorg
11
hi, just reinstalled komodo wallet, and can't find ARRR on there? tried to search ARRR and pirate and nothing came up... is arrr still supported on komodo wallet. it's been ...
Pilner
10
в сях есть множество как в питоне? для удаление дубликатов
Linus
25
Hi everyone, long time no see! 🐼 recently i want to update our Ergo Eco-System map, can everyone help to find out, which to delete and other new to add in? list it, that i can...
HEROKOO
14
55. Hi, how's everything with you?TG大会員2U|82. How's life?TG会員2U|83. Hi, how's everything been treating you?飞机会員2U|84. How's your day been so far?電报会員2U|85. Hey, how's everythi...
Allice Grace
2
читать файл максимально быстро? странный вопрос))
zamtmn
53
I will wait, no problem, I invested in other project also, but with my 8 years experience I can see when something is not good enough. Last bull market everyone was so excited...
jeronim jurakovic
1
If arrr gets implemented on cake wallet. Would that mean arrr/xmr swaps possible in cake wallet like atomic swaps on komodowallet ?
Keks Meister 🏴‍☠️
22
Карта сайта