-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slack channels per matrix #394
Comments
Hey @apujari-hippo, What you are looking to do is possible but unfortunately outside the realm of what the Rather than using the matrix feature, I recommend expanding your config one level up like this: - deploy:
name: test-x
test-name: test-x
slack-channel: channel-x
- deploy:
name: test-y
test-name: test-y
slack-channel: channel-y Config SDKIt may be overkill for a situation like this, but the ConfigSDK can be used to make matrix-like jobs using Dynamic Config and Javascript. example: //index.ts
import * as CircleCI from '@circleci/circleci-config-sdk';
import { testJob, deployJob } from './jobs';
import { isDeployable } from './utils';
const myConfig = new CircleCI.Config();
const myWorkflow = new CircleCI.Workflow('my-workflow');
// Support the three latest versions of Node
const nodeVersions = ["16.19", "18.13", "19.7"];
const testJobs = nodeVersions.map((version) => testJob(version));
testJobs.forEach((job) => {
myConfig.addJob(job);
myWorkflow.addJob(job)
});
if (isDeployable()) {
myConfig.addJob(deployJob);
myWorkflow.addJob(deployJob, {
requires: testJobs.map((job) => job.name)
});
}
myConfig.addWorkflow(myWorkflow);
myConfig.writeFile('dynamicConfig.yml') // jobs/index.ts
import * as CircleCI from "@circleci/circleci-config-sdk";
import { nodeExecutor } from "../executors";
function sanetizeVersion(version: string) {
return version.replace(".", "-");
}
const testJob = (version: string) =>
new CircleCI.Job(`test-${sanetizeVersion(version)}`, nodeExecutor(version), [
new CircleCI.commands.Checkout(),
new CircleCI.commands.Run({
command: "npm install && npm run test",
}),
]);
const deployJob = new CircleCI.Job(
"deploy",
nodeExecutor("14"),
[
new CircleCI.commands.Checkout(),
new CircleCI.commands.Run({
command: "npm install && npm run deploy"
})
]
)
export { testJob, deployJob } |
@KyleTryon The problem with the above solution is the YAML is too big for the Circle CI to ingest, as we have 92 tests in there. |
What is the total size of the config? I have seen some interesting configs with even more than 92 jobs in them. |
|
@apujari-hippo sorry for the late reply. 13K is well within the limits. It sounds like that might be your config before the 92 jobs. What would it be with? You have several megabytes to work with. |
I'm closing this as there hasn't been a comment in more than a year. |
Orb version: 4.12.1
What happened:
I have a list of jobs (aka tests) that run parallelly. I would like to send the status of each job to a separate slack channel.
I have included a sample in the additional information section. The current sample code only lists only 3 tests, but my actual config in production has 95 tests.
How can I achieve this?
Expected behavior:
I was thinking of some kind of key-value pair matrix where I can pass the test name and channel name which can be referenced in the later part of the config.
Additional Information:
Sample GIST: https://gist.github.com/apujari-hippo/50cb076627d3a27adfc93aeb14690faf
The text was updated successfully, but these errors were encountered: