Skip to content

Commit

Permalink
Merge branch 'master' into donal-remove-native-runtimes
Browse files Browse the repository at this point in the history
  • Loading branch information
seadanda authored Nov 29, 2023
2 parents 6027240 + e993dd1 commit 53cb1f3
Show file tree
Hide file tree
Showing 15 changed files with 162 additions and 57 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/gitspiegel-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: gitspiegel sync

# This workflow doesn't do anything, it's only use is to trigger "workflow_run"
# webhook, that'll be consumed by gitspiegel
# This way, gitspiegel won't do mirroring, unless this workflow runs,
# and running the workflow is protected by GitHub

on:
pull_request:
types:
- opened
- synchronize
- unlocked
- ready_for_review
- reopened

jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Do nothing
run: echo "let's go"
2 changes: 1 addition & 1 deletion helm/values-parity-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gcloud-sqlproxy:
common:
env:
GITLAB_PUSH_NAMESPACE: parity/mirrors
GITLAB_JOB_IMAGE: paritytech/ci-unified:bullseye-1.70.0-2023-05-23
GITLAB_JOB_IMAGE: paritytech/ci-unified:bullseye-1.73.0-2023-11-01-v20231025
GITLAB_DOMAIN: gitlab.parity.io
DATA_PATH: /data
IS_DEPLOYMENT: true
Expand Down
2 changes: 1 addition & 1 deletion helm/values-parity-stg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gcloud-sqlproxy:
common:
env:
GITLAB_PUSH_NAMESPACE: parity/mirrors
GITLAB_JOB_IMAGE: paritytech/ci-unified:bullseye-1.70.0-2023-05-23
GITLAB_JOB_IMAGE: paritytech/ci-unified:bullseye-1.73.0-2023-11-01-v20231025
GITLAB_DOMAIN: gitlab-stg.parity.io
DATA_PATH: /data
IS_DEPLOYMENT: true
Expand Down
2 changes: 1 addition & 1 deletion helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ common:
- ReadWriteOnce
env:
GITLAB_PUSH_NAMESPACE: parity/mirrors
GITLAB_JOB_IMAGE: paritytech/ci-linux:production
GITLAB_JOB_IMAGE: paritytech/ci-unified:bullseye-1.73.0-2023-11-01-v20231025
GITLAB_DOMAIN: gitlab.parity.io
PIPELINE_SCRIPTS_REPOSITORY: https://github.com/paritytech/command-bot-scripts/
PIPELINE_SCRIPTS_REF: main
Expand Down
3 changes: 2 additions & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ export const setupApi = (ctx: Context, server: Server): void => {
command,
gitlab: {
job: {
...configuration.gitlab.job,
timeout: "24 hours",
...configuration.gitlab.job, // might override default timeout
variables: { ...configuration.gitlab.job.variables, ...variables },
image: gitlab.defaultJobImage,
},
Expand Down
3 changes: 3 additions & 0 deletions src/bot/events/handlers/genericHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ export async function genericHandler(this: EventHandler): Promise<PullRequestErr
gitlab: {
job: {
image,
...(typeof parsedCommand.configuration.gitlab?.job.timeout === "string"
? { timeout: parsedCommand.configuration.gitlab.job.timeout }
: {}),
tags: parsedCommand.configuration.gitlab?.job.tags || [],
variables: Object.assign(defaultVariables, overriddenVariables),
},
Expand Down
4 changes: 2 additions & 2 deletions src/command-configs/help/parts/commands.pug
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ div(id="link-override-ci-image").command

p Syntax (after command name):
p
code -v CMD_IMAGE=paritytech/ci-unified:bullseye-1.70.0-2023-05-23
code -v CMD_IMAGE=paritytech/ci-unified:bullseye-1.73.0-2023-05-23

p Examples:
p
code #{commandStart} update-ui -v CMD_IMAGE=paritytech/ci-unified:bullseye-1.70.0-2023-05-23 --rust_version=1.70.0
code #{commandStart} update-ui -v CMD_IMAGE=paritytech/ci-unified:bullseye-1.73.0-2023-05-23 --rust_version=1.73.0

div(id="link-rust").command
h5 Rust Log, etc
Expand Down
5 changes: 3 additions & 2 deletions src/gitlab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ export const runCommandInGitlabPipeline = async (ctx: Context, task: Task): Prom
registered the branch, therefore causing the "Reference not found" message.
*/
let wasBranchRegistered = false;
const waitForBranchMaxTries = 3;
const waitForBranchRetryDelayMs = 2000;
const waitForBranchMaxTries = 5;
const waitForBranchRetryDelayMs = 5000;

const branchPresenceUrl = `${gitlabProjectApi}/repository/branches/${branchNameUrlEncoded}`;

Expand Down Expand Up @@ -166,6 +166,7 @@ export const runCommandInGitlabPipeline = async (ctx: Context, task: Task): Prom
.keys({ id: Joi.number().required(), project_id: Joi.number().required() })
.options({ allowUnknown: true }),
),
{ attempts: waitForBranchMaxTries, timeoutMs: waitForBranchRetryDelayMs },
);

logger.info({ pipeline, task }, `Created pipeline for task ${task.id}`);
Expand Down
2 changes: 1 addition & 1 deletion src/gitlab/createCiConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function createCiConfig(
workflow: { rules: [{ if: `$CI_PIPELINE_SOURCE == "api"` }, { if: `$CI_PIPELINE_SOURCE == "web"` }] },
command: {
timeout: "24 hours",
...task.gitlab.job,
...task.gitlab.job, // timeout could be overridden from the command configs
script: [
...`
echo "This job is related to task ${task.id}. ${jobTaskInfoMessage}."
Expand Down
3 changes: 3 additions & 0 deletions src/schema/schema.cmd.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"job": {
"type": "object",
"properties": {
"timeout": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
Expand Down
1 change: 1 addition & 0 deletions src/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type TaskBase<T> = {
requester: string;
gitlab: {
job: {
timeout?: string;
tags: string[];
image: string;
variables: {
Expand Down
4 changes: 2 additions & 2 deletions src/test/github-job-failure.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe("Job failure (GitHub webhook)", () => {
.forGet("/api/v4/projects/paritytech-stg%2Fcommand-bot-test/pipelines/61/jobs")
.thenReply(200, restFixures.gitlab.jobs, jsonResponseHeaders);

await until(async () => !(await mockedPipelineEndpoint.isPending()), 150, 50);
await until(async () => !(await mockedPipelineEndpoint.isPending()), 250, 50);
});

test("Phase 2: pipeline fails", async () => {
Expand All @@ -105,7 +105,7 @@ describe("Job failure (GitHub webhook)", () => {
.forPost("/api/v4/projects/1/pipelines/61/cancel")
.thenReply(200, restFixures.gitlab.cancelledPipeline, jsonResponseHeaders);

await until(async () => !(await mockedEndpoint.isPending()), 100, 50);
await until(async () => !(await mockedEndpoint.isPending()), 250, 50);
});

// TODO: bot should comment about status of the job
Expand Down
2 changes: 1 addition & 1 deletion src/test/github-positive-scenario.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ describe.each(commandsDataProvider)(
.forGet("/api/v4/projects/paritytech-stg%2Fcommand-bot-test/pipelines/61/jobs")
.thenReply(200, restFixtures.gitlab.jobs, jsonResponseHeaders);

await until(async () => !(await mockedPipelineEndpoint.isPending()), 100, 50);
await until(async () => !(await mockedPipelineEndpoint.isPending()), 250, 50);
});

test("Phase 3: cmd-bot updates the comment with a link to the pipeline", async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/test/setup/integration.setupAfterEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ beforeAll(async () => {
await launchBot(mockServers.gitHub.url, mockServers.gitLab.url, gitDaemons);
console.log("Bot launched");

await delay(1000);
await delay(2000);
});

afterAll(async () => {
Expand All @@ -34,5 +34,5 @@ afterAll(async () => {
await stopMockServers();
console.log("MockServers stopped");

await delay(1000);
await delay(2000);
});
Loading

0 comments on commit 53cb1f3

Please sign in to comment.