Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
808d6775dd
commit
edbd287192
|
@ -18,6 +18,7 @@ export default () => {
|
|||
emptyStateSvgPath,
|
||||
projectPath,
|
||||
kasAddress,
|
||||
kasVersion,
|
||||
canAdminCluster,
|
||||
} = el.dataset;
|
||||
|
||||
|
@ -32,6 +33,7 @@ export default () => {
|
|||
emptyStateSvgPath,
|
||||
projectPath,
|
||||
kasAddress,
|
||||
kasVersion,
|
||||
canAdminCluster: parseBoolean(canAdminCluster),
|
||||
},
|
||||
render(createElement) {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
export function generateAgentRegistrationCommand(agentToken, kasAddress) {
|
||||
export function generateAgentRegistrationCommand(agentToken, kasAddress, kasVersion) {
|
||||
return `helm repo add gitlab https://charts.gitlab.io
|
||||
helm repo update
|
||||
helm upgrade --install gitlab-agent gitlab/gitlab-agent \\
|
||||
--namespace gitlab-agent \\
|
||||
--create-namespace \\
|
||||
--set image.tag=v${kasVersion} \\
|
||||
--set config.token=${agentToken} \\
|
||||
--set config.kasAddress=${kasAddress}`;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ export default {
|
|||
GlSprintf,
|
||||
ModalCopyButton,
|
||||
},
|
||||
inject: ['kasAddress'],
|
||||
inject: ['kasAddress', 'kasVersion'],
|
||||
props: {
|
||||
agentToken: {
|
||||
required: true,
|
||||
|
@ -32,7 +32,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
agentRegistrationCommand() {
|
||||
return generateAgentRegistrationCommand(this.agentToken, this.kasAddress);
|
||||
return generateAgentRegistrationCommand(this.agentToken, this.kasAddress, this.kasVersion);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -9,6 +9,7 @@ module Projects::ClusterAgentsHelper
|
|||
empty_state_svg_path: image_path('illustrations/operations-dashboard_empty.svg'),
|
||||
project_path: project.full_path,
|
||||
kas_address: Gitlab::Kas.external_url,
|
||||
kas_version: Gitlab::Kas.version_info,
|
||||
can_admin_cluster: can?(current_user, :admin_cluster, project).to_s
|
||||
}
|
||||
end
|
||||
|
|
|
@ -8,6 +8,7 @@ import ModalCopyButton from '~/vue_shared/components/modal_copy_button.vue';
|
|||
|
||||
const kasAddress = 'kas.example.com';
|
||||
const agentToken = 'agent-token';
|
||||
const kasVersion = '15.0.0';
|
||||
const modalId = INSTALL_AGENT_MODAL_ID;
|
||||
|
||||
describe('InstallAgentModal', () => {
|
||||
|
@ -21,6 +22,7 @@ describe('InstallAgentModal', () => {
|
|||
const createWrapper = () => {
|
||||
const provide = {
|
||||
kasAddress,
|
||||
kasVersion,
|
||||
};
|
||||
|
||||
const propsData = {
|
||||
|
@ -59,7 +61,7 @@ describe('InstallAgentModal', () => {
|
|||
it('renders a copy button', () => {
|
||||
expect(findCopyButton().props()).toMatchObject({
|
||||
title: 'Copy command',
|
||||
text: generateAgentRegistrationCommand(agentToken, kasAddress),
|
||||
text: generateAgentRegistrationCommand(agentToken, kasAddress, kasVersion),
|
||||
modalId,
|
||||
});
|
||||
});
|
||||
|
@ -71,6 +73,7 @@ describe('InstallAgentModal', () => {
|
|||
it('shows code block with agent installation command', () => {
|
||||
expect(findCodeBlock().props('code')).toContain(`--set config.token=${agentToken}`);
|
||||
expect(findCodeBlock().props('code')).toContain(`--set config.kasAddress=${kasAddress}`);
|
||||
expect(findCodeBlock().props('code')).toContain(`--set image.tag=v${kasVersion}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -33,6 +33,7 @@ RSpec.describe Projects::ClusterAgentsHelper do
|
|||
empty_state_svg_path: kind_of(String),
|
||||
can_admin_vulnerability: "true",
|
||||
kas_address: Gitlab::Kas.external_url,
|
||||
kas_version: Gitlab::Kas.version_info,
|
||||
can_admin_cluster: "false"
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue