mirror of
https://github.com/jdalrymple/gitbeaker.git
synced 2026-01-25 16:04:01 +00:00
ci: 🤖 Updated the test docker scripts
This commit is contained in:
parent
ecc7890001
commit
172394837d
@ -4,13 +4,12 @@ services:
|
||||
image: 'gitlab/gitlab-ce'
|
||||
container_name: 'gitlab'
|
||||
environment:
|
||||
GITLAB_URL: 'http://localhost:8080'
|
||||
PERSONAL_ACCESS_TOKEN: ""
|
||||
PERSONAL_ACCESS_TOKEN: ''
|
||||
GITLAB_OMNIBUS_CONFIG: |
|
||||
gitlab_rails['monitoring_whitelist'] = ['0.0.0.0/0', '172.17.0.1'];
|
||||
gitlab_rails['monitoring_whitelist'] = ['0.0.0.0/0', '172.17.0.1'];
|
||||
GITLAB_ROOT_PASSWORD: 'password'
|
||||
ports:
|
||||
- '8080:80'
|
||||
- '8443:443'
|
||||
volumes:
|
||||
- './init_data.rb:/tmp/init_data.rb'
|
||||
- './init.rb:/mnt/init.rb'
|
||||
9
scripts/init.rb
Normal file
9
scripts/init.rb
Normal file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env ruby
|
||||
u = User.first
|
||||
u.admin = true
|
||||
u.save!
|
||||
|
||||
t = PersonalAccessToken.new({ user: u, name: 'gitbeaker', scopes: ['api', 'read_user']})
|
||||
t.save!
|
||||
|
||||
puts t.token
|
||||
38
scripts/probe.js
Normal file
38
scripts/probe.js
Normal file
@ -0,0 +1,38 @@
|
||||
/* eslint-disable */
|
||||
const request = require('got');
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
// Define readiness function
|
||||
async function checkReadiness() {
|
||||
const body = await request.get(`${process.env.GITLAB_URL}/-/readiness?all=1`).json();
|
||||
|
||||
return body.master_check[0].status == 'ok';
|
||||
}
|
||||
|
||||
// Poll GL for a successful readiness status
|
||||
async function run() {
|
||||
let attempt = 0;
|
||||
|
||||
await sleep(120000);
|
||||
|
||||
while (attempt < 25) {
|
||||
try {
|
||||
const ready = await checkReadiness();
|
||||
|
||||
if (ready) break;
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
}
|
||||
|
||||
await sleep(10000);
|
||||
|
||||
attempt += 1;
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
@ -1,7 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
u = User.first
|
||||
|
||||
t = PersonalAccessToken.new({ user: u, name: 'node-gitlab', scopes: ['api']})
|
||||
t.save!
|
||||
|
||||
puts t.token
|
||||
@ -1,42 +0,0 @@
|
||||
const request = require('ky-universal');
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
// Define readiness function
|
||||
async function check_readiness() {
|
||||
const r = await request.get(`${process.env.GITLAB_URL}/-/readiness`);
|
||||
const body = await r.json();
|
||||
|
||||
return ![
|
||||
body.db_check.status,
|
||||
body.redis_check.status,
|
||||
body.cache_check.status,
|
||||
body.queues_check.status,
|
||||
body.shared_state_check.status,
|
||||
body.gitaly_check.status,
|
||||
].some(el => el != 'ok');
|
||||
}
|
||||
|
||||
// Poll GL for a successful readiness status
|
||||
async function run() {
|
||||
let attempt = 0;
|
||||
|
||||
while (attempt < 25) {
|
||||
try {
|
||||
let ready = await check_readiness();
|
||||
|
||||
if (!ready) break;
|
||||
} catch(e) {
|
||||
}
|
||||
|
||||
await sleep(10000);
|
||||
|
||||
attempt++;
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
Loading…
x
Reference in New Issue
Block a user