diff options
Diffstat (limited to 'app/assets/javascripts/ci/runner')
6 files changed, 87 insertions, 6 deletions
diff --git a/app/assets/javascripts/ci/runner/admin_new_runner/admin_new_runner_app.vue b/app/assets/javascripts/ci/runner/admin_new_runner/admin_new_runner_app.vue index 97163c1f55c..1e4ef535e1b 100644 --- a/app/assets/javascripts/ci/runner/admin_new_runner/admin_new_runner_app.vue +++ b/app/assets/javascripts/ci/runner/admin_new_runner/admin_new_runner_app.vue @@ -59,7 +59,8 @@ export default { <h2 class="gl-font-size-h2 gl-my-5"> {{ s__('Runners|Platform') }} </h2> - <runner-platforms-radio-group v-model="platform" /> + + <runner-platforms-radio-group v-model="platform" admin /> <hr aria-hidden="true" /> diff --git a/app/assets/javascripts/ci/runner/components/runner_cloud_connection_form.vue b/app/assets/javascripts/ci/runner/components/runner_cloud_connection_form.vue new file mode 100644 index 00000000000..c213607670e --- /dev/null +++ b/app/assets/javascripts/ci/runner/components/runner_cloud_connection_form.vue @@ -0,0 +1,15 @@ +<script> +import { s__ } from '~/locale'; + +export default { + name: 'RunnerCloudForm', + i18n: { + title: s__('Runners|Google Cloud connection'), + }, +}; +</script> +<template> + <div> + <h2 class="gl-font-size-h2">{{ $options.i18n.title }}</h2> + </div> +</template> diff --git a/app/assets/javascripts/ci/runner/components/runner_platforms_radio_group.vue b/app/assets/javascripts/ci/runner/components/runner_platforms_radio_group.vue index a841f66b566..ba50932be4e 100644 --- a/app/assets/javascripts/ci/runner/components/runner_platforms_radio_group.vue +++ b/app/assets/javascripts/ci/runner/components/runner_platforms_radio_group.vue @@ -3,11 +3,13 @@ import DOCKER_LOGO_URL from '@gitlab/svgs/dist/illustrations/third-party-logos/c import LINUX_LOGO_URL from '@gitlab/svgs/dist/illustrations/third-party-logos/linux.svg?url'; import KUBERNETES_LOGO_URL from '@gitlab/svgs/dist/illustrations/logos/kubernetes.svg?url'; import { GlFormRadioGroup, GlIcon, GlLink } from '@gitlab/ui'; +import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import { LINUX_PLATFORM, MACOS_PLATFORM, WINDOWS_PLATFORM, + GOOGLE_CLOUD_PLATFORM, DOCKER_HELP_URL, KUBERNETES_HELP_URL, } from '../constants'; @@ -21,18 +23,29 @@ export default { GlIcon, RunnerPlatformsRadio, }, + mixins: [glFeatureFlagsMixin()], props: { value: { type: String, required: false, default: null, }, + admin: { + type: Boolean, + required: false, + default: false, + }, }, data() { return { model: this.value, }; }, + computed: { + gcpEnabled() { + return this.glFeatures.gcpRunner && !this.admin; + }, + }, watch: { model() { this.$emit('input', this.model); @@ -42,7 +55,7 @@ export default { LINUX_LOGO_URL, MACOS_PLATFORM, WINDOWS_PLATFORM, - + GOOGLE_CLOUD_PLATFORM, DOCKER_HELP_URL, DOCKER_LOGO_URL, KUBERNETES_HELP_URL, @@ -73,6 +86,17 @@ export default { </div> </div> + <div v-if="gcpEnabled" class="gl-mt-3 gl-mb-6"> + <label>{{ s__('Runners|Cloud') }}</label> + + <div class="gl-display-flex gl-flex-wrap gl-gap-3"> + <!-- eslint-disable @gitlab/vue-require-i18n-strings --> + <runner-platforms-radio v-model="model" :value="$options.GOOGLE_CLOUD_PLATFORM"> + Google Cloud + </runner-platforms-radio> + </div> + </div> + <div class="gl-mt-3 gl-mb-6"> <label>{{ s__('Runners|Containers') }}</label> diff --git a/app/assets/javascripts/ci/runner/constants.js b/app/assets/javascripts/ci/runner/constants.js index d04d75b6e75..b275a8f5749 100644 --- a/app/assets/javascripts/ci/runner/constants.js +++ b/app/assets/javascripts/ci/runner/constants.js @@ -220,6 +220,7 @@ export const GROUP_FILTERED_SEARCH_NAMESPACE = 'group_runners'; export const LINUX_PLATFORM = 'linux'; export const MACOS_PLATFORM = 'osx'; export const WINDOWS_PLATFORM = 'windows'; +export const GOOGLE_CLOUD_PLATFORM = 'google'; // About Gitlab Runner Package host export const RUNNER_PACKAGE_HOST = 'gitlab-runner-downloads.s3.amazonaws.com'; diff --git a/app/assets/javascripts/ci/runner/group_new_runner/group_new_runner_app.vue b/app/assets/javascripts/ci/runner/group_new_runner/group_new_runner_app.vue index c907f9c8982..21058c93d15 100644 --- a/app/assets/javascripts/ci/runner/group_new_runner/group_new_runner_app.vue +++ b/app/assets/javascripts/ci/runner/group_new_runner/group_new_runner_app.vue @@ -2,11 +2,17 @@ import { createAlert, VARIANT_SUCCESS } from '~/alert'; import { visitUrl, setUrlParams } from '~/lib/utils/url_utility'; import { s__ } from '~/locale'; - +import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import RegistrationCompatibilityAlert from '~/ci/runner/components/registration/registration_compatibility_alert.vue'; import RunnerPlatformsRadioGroup from '~/ci/runner/components/runner_platforms_radio_group.vue'; +import RunnerCloudConnectionForm from '~/ci/runner/components/runner_cloud_connection_form.vue'; import RunnerCreateForm from '~/ci/runner/components/runner_create_form.vue'; -import { DEFAULT_PLATFORM, GROUP_TYPE, PARAM_KEY_PLATFORM } from '../constants'; +import { + DEFAULT_PLATFORM, + GOOGLE_CLOUD_PLATFORM, + GROUP_TYPE, + PARAM_KEY_PLATFORM, +} from '../constants'; import { saveAlertToLocalStorage } from '../local_storage_alert/save_alert_to_local_storage'; export default { @@ -14,8 +20,10 @@ export default { components: { RegistrationCompatibilityAlert, RunnerPlatformsRadioGroup, + RunnerCloudConnectionForm, RunnerCreateForm, }, + mixins: [glFeatureFlagsMixin()], props: { groupId: { type: String, @@ -27,6 +35,14 @@ export default { platform: DEFAULT_PLATFORM, }; }, + computed: { + gcpEnabled() { + return this.glFeatures.gcpRunner; + }, + showCloudForm() { + return this.platform === GOOGLE_CLOUD_PLATFORM && this.gcpEnabled; + }, + }, methods: { onSaved(runner) { const params = { [PARAM_KEY_PLATFORM]: this.platform }; @@ -65,11 +81,15 @@ export default { <h2 class="gl-font-size-h2 gl-my-5"> {{ s__('Runners|Platform') }} </h2> + <runner-platforms-radio-group v-model="platform" /> <hr aria-hidden="true" /> + <runner-cloud-connection-form v-if="showCloudForm" /> + <runner-create-form + v-else :runner-type="$options.GROUP_TYPE" :group-id="groupId" @saved="onSaved" diff --git a/app/assets/javascripts/ci/runner/project_new_runner/project_new_runner_app.vue b/app/assets/javascripts/ci/runner/project_new_runner/project_new_runner_app.vue index 241479a8c98..8f3dfbf42ad 100644 --- a/app/assets/javascripts/ci/runner/project_new_runner/project_new_runner_app.vue +++ b/app/assets/javascripts/ci/runner/project_new_runner/project_new_runner_app.vue @@ -2,11 +2,17 @@ import { createAlert, VARIANT_SUCCESS } from '~/alert'; import { visitUrl, setUrlParams } from '~/lib/utils/url_utility'; import { s__ } from '~/locale'; - +import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import RegistrationCompatibilityAlert from '~/ci/runner/components/registration/registration_compatibility_alert.vue'; import RunnerPlatformsRadioGroup from '~/ci/runner/components/runner_platforms_radio_group.vue'; +import RunnerCloudConnectionForm from '~/ci/runner/components/runner_cloud_connection_form.vue'; import RunnerCreateForm from '~/ci/runner/components/runner_create_form.vue'; -import { DEFAULT_PLATFORM, PARAM_KEY_PLATFORM, PROJECT_TYPE } from '../constants'; +import { + DEFAULT_PLATFORM, + PARAM_KEY_PLATFORM, + GOOGLE_CLOUD_PLATFORM, + PROJECT_TYPE, +} from '../constants'; import { saveAlertToLocalStorage } from '../local_storage_alert/save_alert_to_local_storage'; export default { @@ -14,8 +20,10 @@ export default { components: { RegistrationCompatibilityAlert, RunnerPlatformsRadioGroup, + RunnerCloudConnectionForm, RunnerCreateForm, }, + mixins: [glFeatureFlagsMixin()], props: { projectId: { type: String, @@ -27,6 +35,14 @@ export default { platform: DEFAULT_PLATFORM, }; }, + computed: { + gcpEnabled() { + return this.glFeatures.gcpRunner; + }, + showCloudForm() { + return this.platform === GOOGLE_CLOUD_PLATFORM && this.gcpEnabled; + }, + }, methods: { onSaved(runner) { const params = { [PARAM_KEY_PLATFORM]: this.platform }; @@ -65,11 +81,15 @@ export default { <h2 class="gl-font-size-h2 gl-my-5"> {{ s__('Runners|Platform') }} </h2> + <runner-platforms-radio-group v-model="platform" /> <hr aria-hidden="true" /> + <runner-cloud-connection-form v-if="showCloudForm" /> + <runner-create-form + v-else :runner-type="$options.PROJECT_TYPE" :project-id="projectId" @saved="onSaved" |