Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 10x 10x 40x 73x 73x 34x 34x 29x 73x 73x 29x 29x 29x 44x | import { ACTIVE_CONNECTION_TIME, NAME_MAX_LENGTH } from './constants'; function getTruncatedName(name) { return name.substring(0, NAME_MAX_LENGTH); } export function generateAgentRegistrationCommand({ name, token, version, address }) { return `helm repo add gitlab https://charts.gitlab.io helm repo update helm upgrade --install ${name} gitlab/gitlab-agent \\ --namespace gitlab-agent-${getTruncatedName(name)} \\ --create-namespace \\ --set image.tag=v${version} \\ --set config.token=${token} \\ --set config.kasAddress=${address}`; } export function getAgentConfigPath(clusterAgentName) { return `.gitlab/agents/${clusterAgentName}`; } export function getAgentLastContact(tokens = []) { let lastContact = null; tokens.forEach((token) => { const lastContactToDate = new Date(token.lastUsedAt).getTime(); if (lastContactToDate > lastContact) { lastContact = lastContactToDate; } }); return lastContact; } export function getAgentStatus(lastContact) { if (lastContact) { const now = new Date().getTime(); const diff = now - lastContact; return diff >= ACTIVE_CONNECTION_TIME ? 'inactive' : 'active'; } return 'unused'; } |