summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-19 03:09:59 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-19 03:09:59 +0000
commit7fdacd20dec0db3507643c7e89e9f3d35892adef (patch)
tree524b5d61aa7804096d33d555181480802f12eea7
parent57a4861dd1841a53cb966b566b1eee4adb254675 (diff)
downloadgitlab-ce-7fdacd20dec0db3507643c7e89e9f3d35892adef.tar.gz
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--.gitignore1
-rw-r--r--app/assets/javascripts/boards/components/board_content.vue68
-rw-r--r--app/assets/javascripts/boards/components/board_content_layout.vue50
-rw-r--r--app/assets/javascripts/boards/index.js2
-rw-r--r--app/assets/stylesheets/fontawesome_custom.scss4
-rw-r--r--app/views/groups/runners/_runner.html.haml2
-rw-r--r--changelogs/unreleased/225951-replace-fa-pencil-icon.yml5
-rw-r--r--changelogs/unreleased/add_model_for_ciliumnetworkpolicy.yml5
-rw-r--r--data/whats_new/202008180001_12_10.yml51
-rw-r--r--data/whats_new/202008180002_13_0.yml51
-rw-r--r--data/whats_new/202008180003_13_01.yml41
-rw-r--r--doc/user/admin_area/license.md8
-rw-r--r--lib/gitlab/kubernetes/cilium_network_policy.rb89
-rw-r--r--lib/gitlab/kubernetes/network_policy.rb7
-rw-r--r--lib/gitlab/kubernetes/network_policy_common.rb8
-rw-r--r--spec/frontend/boards/components/board_content_layout_spec.js66
-rw-r--r--spec/frontend/boards/components/board_content_spec.js40
-rw-r--r--spec/lib/gitlab/kubernetes/cilium_network_policy_spec.rb217
-rw-r--r--spec/lib/gitlab/kubernetes/network_policy_spec.rb23
-rw-r--r--spec/support/shared_examples/lib/gitlab/kubernetes/network_policy_common_shared_examples.rb15
20 files changed, 656 insertions, 97 deletions
diff --git a/.gitignore b/.gitignore
index 71ecf31a50b..38beab164cb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -77,7 +77,6 @@ eslint-report.html
/locale/**/LC_MESSAGES
/locale/**/*.time_stamp
/.rspec
-/.gitlab_pages_secret
/.gitlab_smime_key
/.gitlab_smime_cert
package-lock.json
diff --git a/app/assets/javascripts/boards/components/board_content.vue b/app/assets/javascripts/boards/components/board_content.vue
index c42295792f1..b8a78cb8834 100644
--- a/app/assets/javascripts/boards/components/board_content.vue
+++ b/app/assets/javascripts/boards/components/board_content.vue
@@ -1,61 +1,19 @@
<script>
-import { mapState } from 'vuex';
-import BoardColumn from 'ee_else_ce/boards/components/board_column.vue';
-import EpicsSwimlanes from 'ee_component/boards/components/epics_swimlanes.vue';
-import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
+import BoardContentLayout from '~/boards/components/board_content_layout.vue';
+import BoardColumn from '~/boards/components/board_column.vue';
export default {
components: {
+ BoardContentLayout,
BoardColumn,
- EpicsSwimlanes,
- },
- mixins: [glFeatureFlagMixin()],
- props: {
- lists: {
- type: Array,
- required: true,
- },
- canAdminList: {
- type: Boolean,
- required: true,
- },
- groupId: {
- type: Number,
- required: false,
- default: null,
- },
- disabled: {
- type: Boolean,
- required: true,
- },
- issueLinkBase: {
- type: String,
- required: true,
- },
- rootPath: {
- type: String,
- required: true,
- },
- boardId: {
- type: String,
- required: true,
- },
- },
- computed: {
- ...mapState(['isShowingEpicsSwimlanes', 'boardLists']),
- isSwimlanesOn() {
- return this.glFeatures.boardsWithSwimlanes && this.isShowingEpicsSwimlanes;
- },
},
};
</script>
<template>
- <div>
- <div
- v-if="!isSwimlanesOn"
- class="boards-list gl-w-full gl-py-5 gl-px-3 gl-white-space-nowrap"
- data-qa-selector="boards_list"
+ <board-content-layout v-bind="$attrs">
+ <template
+ #board-content-decoration="{ lists, canAdminList, groupId, disabled, issueLinkBase, rootPath, boardId }"
>
<board-column
v-for="list in lists"
@@ -69,16 +27,6 @@ export default {
:root-path="rootPath"
:board-id="boardId"
/>
- </div>
- <epics-swimlanes
- v-else
- ref="swimlanes"
- :lists="boardLists"
- :can-admin-list="canAdminList"
- :disabled="disabled"
- :board-id="boardId"
- :group-id="groupId"
- :root-path="rootPath"
- />
- </div>
+ </template>
+ </board-content-layout>
</template>
diff --git a/app/assets/javascripts/boards/components/board_content_layout.vue b/app/assets/javascripts/boards/components/board_content_layout.vue
new file mode 100644
index 00000000000..03b2597f6aa
--- /dev/null
+++ b/app/assets/javascripts/boards/components/board_content_layout.vue
@@ -0,0 +1,50 @@
+<script>
+export default {
+ props: {
+ lists: {
+ type: Array,
+ required: true,
+ },
+ canAdminList: {
+ type: Boolean,
+ required: true,
+ },
+ groupId: {
+ type: Number,
+ required: false,
+ default: null,
+ },
+ disabled: {
+ type: Boolean,
+ required: true,
+ },
+ issueLinkBase: {
+ type: String,
+ required: true,
+ },
+ rootPath: {
+ type: String,
+ required: true,
+ },
+ boardId: {
+ type: String,
+ required: true,
+ },
+ isSwimlanesOff: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
+ },
+};
+</script>
+
+<template>
+ <div
+ :class="{ 'boards-list gl-w-full gl-py-5 gl-px-3 gl-white-space-nowrap': isSwimlanesOff }"
+ data-qa-selector="boards_list"
+ data-testid="boards_list"
+ >
+ <slot name="board-content-decoration" v-bind="$props"></slot>
+ </div>
+</template>
diff --git a/app/assets/javascripts/boards/index.js b/app/assets/javascripts/boards/index.js
index 94865516fc4..74b27a1f2b3 100644
--- a/app/assets/javascripts/boards/index.js
+++ b/app/assets/javascripts/boards/index.js
@@ -4,6 +4,7 @@ import { mapActions } from 'vuex';
import 'ee_else_ce/boards/models/issue';
import 'ee_else_ce/boards/models/list';
+import BoardContent from 'ee_else_ce/boards/components/board_content.vue';
import BoardSidebar from 'ee_else_ce/boards/components/board_sidebar';
import initNewListDropdown from 'ee_else_ce/boards/components/new_list_dropdown';
import boardConfigToggle from 'ee_else_ce/boards/config_toggle';
@@ -18,7 +19,6 @@ import {
} from 'ee_else_ce/boards/ee_functions';
import VueApollo from 'vue-apollo';
-import BoardContent from '~/boards/components/board_content.vue';
import createDefaultClient from '~/lib/graphql';
import Flash from '~/flash';
import { __ } from '~/locale';
diff --git a/app/assets/stylesheets/fontawesome_custom.scss b/app/assets/stylesheets/fontawesome_custom.scss
index 28bea9233cb..cf08f1778f1 100644
--- a/app/assets/stylesheets/fontawesome_custom.scss
+++ b/app/assets/stylesheets/fontawesome_custom.scss
@@ -262,10 +262,6 @@
content: '\f0ac';
}
-.fa-pencil::before {
- content: '\f040';
-}
-
.fa-pause::before {
content: '\f04c';
}
diff --git a/app/views/groups/runners/_runner.html.haml b/app/views/groups/runners/_runner.html.haml
index 47aa8faae97..07cbcd8401e 100644
--- a/app/views/groups/runners/_runner.html.haml
+++ b/app/views/groups/runners/_runner.html.haml
@@ -68,7 +68,7 @@
.btn-group.table-action-buttons
.btn-group
= link_to edit_group_runner_path(@group, runner), class: 'btn btn-default has-tooltip', title: _('Edit'), ref: 'tooltip', aria: { label: _('Edit') }, data: { placement: 'top', container: 'body'} do
- = icon('pencil')
+ = sprite_icon('pencil')
.btn-group
- if runner.active?
= link_to pause_group_runner_path(@group, runner), method: :post, class: 'btn btn-default has-tooltip', title: _('Pause'), ref: 'tooltip', aria: { label: _('Pause') }, data: { placement: 'top', container: 'body', confirm: _('Are you sure?') } do
diff --git a/changelogs/unreleased/225951-replace-fa-pencil-icon.yml b/changelogs/unreleased/225951-replace-fa-pencil-icon.yml
new file mode 100644
index 00000000000..9beb40d5628
--- /dev/null
+++ b/changelogs/unreleased/225951-replace-fa-pencil-icon.yml
@@ -0,0 +1,5 @@
+---
+title: Replace fa-pencil icon with GitLab SVG
+merge_request: 39648
+author:
+type: other
diff --git a/changelogs/unreleased/add_model_for_ciliumnetworkpolicy.yml b/changelogs/unreleased/add_model_for_ciliumnetworkpolicy.yml
new file mode 100644
index 00000000000..aae574a6cb5
--- /dev/null
+++ b/changelogs/unreleased/add_model_for_ciliumnetworkpolicy.yml
@@ -0,0 +1,5 @@
+---
+title: Add model for CiliumNetworkPolicy
+merge_request: 38848
+author:
+type: added
diff --git a/data/whats_new/202008180001_12_10.yml b/data/whats_new/202008180001_12_10.yml
new file mode 100644
index 00000000000..33c007de8d0
--- /dev/null
+++ b/data/whats_new/202008180001_12_10.yml
@@ -0,0 +1,51 @@
+---
+- title: Create and view requirements in GitLab
+ body: The first step towards managing requirements from within GitLab is here! This initial release allows users to create and view requirements at a project level. As Requirements Management evolves in GitLab, stay tuned for support for traceability between all artifacts, creating a seamless workflow to visually demonstrate completeness and compliance.
+ stage: Plan
+ self-managed: true
+ gitlab-com: true
+ packages: ultimate, gold
+ url: https://docs.gitlab.com/ee/user/project/requirements/index.html
+ image_url:
+ published_at: 2020-04-22
+ release: 12.10
+- title: Retrieve CI/CD secrets from HashiCorp Vault
+ body: In this release, GitLab adds support for lightweight JSON Web Token (JWT) authentication to integrate with your existing HashiCorp Vault. Now, you can seamlessly provide secrets to CI/CD jobs by taking advantage of HashiCorp's JWT authentication method rather than manually having to provide secrets as a variable in GitLab.
+ stage: Release
+ self-managed: true
+ gitlab-com: true
+ packages: All
+ url: https://docs.gitlab.com/ee/ci/examples/authenticating-with-hashicorp-vault/index.html
+ image_url: https://about.gitlab.com/images/12_10/jwt-vault-1.png
+ published_at: 2020-04-22
+ release: 12.10
+- title: Epic and Issue Health Tracking
+ body: To help users track projects and in-flight work GitLab now enables you to report on and quickly respond to the health of individual issues and epics by showing a red, amber, or green health status on your Epic Tree. Assign an issue a health status of On track (green), Needs attention (amber), or At risk (red) and see an aggregate report of health at the Epic level. Quickly view and analyze where a collection of work is at risk so you can open up the right discussions at the right time and keep work on track!
+ stage: Plan
+ self-managed: true
+ gitlab-com: true
+ packages: ultimate, gold
+ url: https://docs.gitlab.com/ee/user/project/issues/index.html#health-status-ultimate
+ image_url: https://about.gitlab.com/images/12_10/epic-health-status.png
+ published_at: 2020-04-22
+ release: 12.10
+- title: Import Issues from Jira to GitLab
+ body: Until now, the only way to get Jira issues into GitLab was manually, with our CSV importer, or by hand-rolling your own migration utility. GitLab 12.10 includes an MVC to automatically import your Jira issues into GitLab. This is the first of many planned enhancements to make transitioning from Jira to GitLab as frictionless as possible.
+ stage: Plan
+ self-managed: true
+ gitlab-com: true
+ packages: All
+ url: https://docs.gitlab.com/ee/user/project/import/jira.html
+ image_url: https://about.gitlab.com/images/12_10/jira-importer.png
+ published_at: 2020-04-22
+ release: 12.10
+- title: Autoscaling GitLab CI jobs on AWS Fargate
+ body: You can now auto-scale GitLab CI on AWS Fargate with the MVC release of GitLab’s AWS Fargate Driver. With this new autoscaling pattern, GitLab’s AWS Fargate driver automatically runs each build in a separate and isolated container on Amazon’s Elastic Container Service (ECS) using a user-defined container image.
+ stage: Verify
+ self-managed: true
+ gitlab-com: false
+ packages: core, starter, premium, ultimate
+ url: https://gitlab.com/gitlab-org/ci-cd/custom-executor-drivers/fargate/-/blob/master/docs/README.md
+ image_url: https://about.gitlab.com/images/12_9/autoscaling_ci_fargate.png
+ published_at: 2020-04-22
+ release: 12.10
diff --git a/data/whats_new/202008180002_13_0.yml b/data/whats_new/202008180002_13_0.yml
new file mode 100644
index 00000000000..7b43d390940
--- /dev/null
+++ b/data/whats_new/202008180002_13_0.yml
@@ -0,0 +1,51 @@
+---
+- title: Gitaly Cluster for High Availability Git Storage
+ body: GitLab now supports highly available Git storage without using NFS. High Availability (HA) configurations improve the availability of important systems, like Git storage, by removing single points of failure, detecting outages, and automatically switching to a replica. This means that an individual component of the system can fail without causing the end user to experience an outage. Access to Git repositories is critical to developers and businesses, because when an outage occurs, developers can’t push code, and deployments are blocked.
+ stage: Create
+ self-managed: true
+ gitlab-com: false
+ packages: core, starter, premium, ultimate
+ url: https://docs.gitlab.com/ee/administration/gitaly/praefect.html
+ image_url: https://about.gitlab.com/images/13_0/praefect-architecture.png
+ published_at: 2020-05-22
+ release: 13.0
+- title: Auto Deploy to ECS
+ body: Until now, there hasn’t been a simple way to deploy to Amazon Web Services. As a result, GitLab users had to spend a lot of time figuring out their own configuration. In GitLab 13.0, Auto DevOps has been extended to support deployment to AWS! GitLab users who are deploying to AWS Elastic Container Service (ECS) can now take advantage of Auto DevOps, even if they are not using Kubernetes.
+ stage: Release
+ self-managed: true
+ gitlab-com: true
+ packages: All
+ url: https://docs.gitlab.com/ee/topics/autodevops/index.html#aws-ecs
+ image_url:
+ published_at: 2020-05-22
+ release: 13.0
+- title: View Epic Hierarchy on a Roadmap
+ body: When leveraging Multi-Level Epics, it can be difficult to keep track of where each child epic lives on the Roadmap. You can now quickly expand a parent epic on your roadmap to view all its child epics to ensure work is properly organized and your planned timeline is on track!
+ stage: Plan
+ self-managed: true
+ gitlab-com: true
+ packages: ultimate, gold
+ url: https://docs.gitlab.com/ee/user/group/roadmap/
+ image_url: https://about.gitlab.com/images/13_0/Expand-Epic-Hierarchy-Roadmap_roadmap.png
+ published_at: 2020-05-22
+ release: 13.0
+- title: Versioned Snippets
+ body: Snippets in GitLab are now version controlled by a Git repository. When editing a Snippet, each change creates a commit. Snippets can also be cloned to make edits locally, and then pushed back to the Snippet repository.
+ stage: Create
+ self-managed: true
+ gitlab-com: true
+ packages: All
+ url: https://docs.gitlab.com/ee/user/snippets.html#versioned-snippets
+ image_url: https://about.gitlab.com/images/13_0/phikai-versioned-snippets.png
+ published_at: 2020-05-22
+ release: 13.0
+- title: Dark Theme in the Web IDE
+ body: For people who spend time working in code editors, the ability to customize the environment to match their preferences is important. Dark themes are some of the most popular for other editors and important for providing a comfortable experience. That's why we're excited that the GitLab Web IDE is now completely themed dark for users who choose the Dark syntax highlighting theme perference!
+ stage: Create
+ self-managed: true
+ gitlab-com: true
+ packages: All
+ url: https://docs.gitlab.com/ee/user/project/web_ide/#themes
+ image_url: https://about.gitlab.com/images/13_0/phikai-web-ide-dark-theme.png
+ published_at: 2020-05-22
+ release: 13.0
diff --git a/data/whats_new/202008180003_13_01.yml b/data/whats_new/202008180003_13_01.yml
new file mode 100644
index 00000000000..6bde6f6397d
--- /dev/null
+++ b/data/whats_new/202008180003_13_01.yml
@@ -0,0 +1,41 @@
+---
+- title: Manage IT Alerts in GitLab
+ body: GitLab is excited to introduce Alert Management to aggregate multiple IT service alerts in one interface, helping your team triage alerts and promote them to Incidents. We’ve added the ability to triage alerts in a list view, view alert details, assign alerts, update the status of alerts, and create Incident Issues from Alerts.
+ stage: Monitor
+ self-managed: true
+ gitlab-com: true
+ packages: All
+ url: https://docs.gitlab.com/ee/user/project/operations/alert_management.html
+ image_url: https://about.gitlab.com/images/13_1/alert_management.png
+ published_at: 2020-06-22
+ release: 13.1
+- title: Accessibility Testing Merge Request Widget
+ body: Today, developers who want to ensure their application is accessible to everyone suffer from slow feedback loops, which make it difficult to catch degradations in their code. In GitLab 13.1, merge requests can have a widget that details accessibility degradations related to the changed pages. This will immediately show developers the impact of their changes, which helps prevent degradations before they are merged and deployed.
+ stage: Verify
+ self-managed: true
+ gitlab-com: true
+ packages: All
+ url: https://docs.gitlab.com/ee/user/project/merge_requests/accessibility_testing.html#accessibility-merge-request-widget
+ image_url: https://about.gitlab.com/images/13_1/a11y-merge-request-widget.png
+ published_at: 2020-06-22
+ release: 13.1
+- title: Mark any Design Thread as Resolved
+ body: When you receive lots of feedback on a Design, the number of comment pins can build up quickly! As your discussion thread grows, it gets hard to know which discussions are complete and which still need work. Now you’ll have the ability to mark any comment as Resolved to signify that it is now complete. Even better — your resolved comment pins will disappear from the Design so you can focus on what’s left!
+ stage: Create
+ self-managed: true
+ gitlab-com: true
+ packages: All
+ url: https://docs.gitlab.com/ee/user/project/issues/design_management.html#resolve-design-threads
+ image_url: https://about.gitlab.com/images/13_1/resolve-design-comment.gif
+ published_at: 2020-06-22
+ release: 13.1
+- title: Merge Request Reviews moved to Core
+ body: Originally introduced in GitLab 11.4 as a GitLab Premium feature, Merge Request Reviews allow merge request reviewers to submit multiple comments at once, cutting down on notification noise for the merge request author, and allowing for a more cohesive and streamlined review process.
+ stage: Create
+ self-managed: true
+ gitlab-com: true
+ packages: All
+ url: https://docs.gitlab.com/ee/user/discussions/index.html#merge-request-reviews
+ image_url: https://about.gitlab.com/images/13_1/batch_comments.png
+ published_at: 2020-06-22
+ release: 13.1
diff --git a/doc/user/admin_area/license.md b/doc/user/admin_area/license.md
index c5e29612596..2c849db66b1 100644
--- a/doc/user/admin_area/license.md
+++ b/doc/user/admin_area/license.md
@@ -102,6 +102,14 @@ In order to get back all the previous functionality, a new license must be uploa
To fall back to having only the Core features active, you'll need to delete the
expired license(s).
+### Remove a license
+
+To remove a license from a self-managed instance:
+
+1. Go to the [Admin Area](index.md) (click the wrench in the top navigation bar).
+1. Click **License** in the left sidebar.
+1. Click **Remove License**.
+
## License history
It's possible to upload and view more than one license,
diff --git a/lib/gitlab/kubernetes/cilium_network_policy.rb b/lib/gitlab/kubernetes/cilium_network_policy.rb
new file mode 100644
index 00000000000..55afd2b586e
--- /dev/null
+++ b/lib/gitlab/kubernetes/cilium_network_policy.rb
@@ -0,0 +1,89 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Kubernetes
+ class CiliumNetworkPolicy
+ include NetworkPolicyCommon
+ extend ::Gitlab::Utils::Override
+
+ API_VERSION = "cilium.io/v2"
+ KIND = 'CiliumNetworkPolicy'
+
+ def initialize(name:, namespace:, selector:, ingress:, resource_version:, labels: nil, creation_timestamp: nil, egress: nil)
+ @name = name
+ @namespace = namespace
+ @labels = labels
+ @creation_timestamp = creation_timestamp
+ @selector = selector
+ @resource_version = resource_version
+ @ingress = ingress
+ @egress = egress
+ end
+
+ def generate
+ ::Kubeclient::Resource.new.tap do |resource|
+ resource.kind = KIND
+ resource.apiVersion = API_VERSION
+ resource.metadata = metadata
+ resource.spec = spec
+ end
+ end
+
+ def self.from_yaml(manifest)
+ return unless manifest
+
+ policy = YAML.safe_load(manifest, symbolize_names: true)
+ return if !policy[:metadata] || !policy[:spec]
+
+ metadata = policy[:metadata]
+ spec = policy[:spec]
+ self.new(
+ name: metadata[:name],
+ namespace: metadata[:namespace],
+ resource_version: metadata[:resourceVersion],
+ labels: metadata[:labels],
+ selector: spec[:endpointSelector],
+ ingress: spec[:ingress],
+ egress: spec[:egress]
+ )
+ rescue Psych::SyntaxError, Psych::DisallowedClass
+ nil
+ end
+
+ def self.from_resource(resource)
+ return unless resource
+ return if !resource[:metadata] || !resource[:spec]
+
+ metadata = resource[:metadata]
+ spec = resource[:spec].to_h
+ self.new(
+ name: metadata[:name],
+ namespace: metadata[:namespace],
+ resource_version: metadata[:resourceVersion],
+ labels: metadata[:labels]&.to_h,
+ creation_timestamp: metadata[:creationTimestamp],
+ selector: spec[:endpointSelector],
+ ingress: spec[:ingress],
+ egress: spec[:egress]
+ )
+ end
+
+ private
+
+ attr_reader :name, :namespace, :labels, :creation_timestamp, :resource_version, :ingress, :egress
+
+ def selector
+ @selector ||= {}
+ end
+
+ override :spec
+ def spec
+ {
+ endpointSelector: selector,
+ ingress: ingress,
+ egress: egress
+ }
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/kubernetes/network_policy.rb b/lib/gitlab/kubernetes/network_policy.rb
index 53498e45242..28810dc4453 100644
--- a/lib/gitlab/kubernetes/network_policy.rb
+++ b/lib/gitlab/kubernetes/network_policy.rb
@@ -17,6 +17,13 @@ module Gitlab
@egress = egress
end
+ def generate
+ ::Kubeclient::Resource.new.tap do |resource|
+ resource.metadata = metadata
+ resource.spec = spec
+ end
+ end
+
def self.from_yaml(manifest)
return unless manifest
diff --git a/lib/gitlab/kubernetes/network_policy_common.rb b/lib/gitlab/kubernetes/network_policy_common.rb
index 0c408140121..3b6e46d21ef 100644
--- a/lib/gitlab/kubernetes/network_policy_common.rb
+++ b/lib/gitlab/kubernetes/network_policy_common.rb
@@ -5,13 +5,6 @@ module Gitlab
module NetworkPolicyCommon
DISABLED_BY_LABEL = :'network-policy.gitlab.com/disabled_by'
- def generate
- ::Kubeclient::Resource.new.tap do |resource|
- resource.metadata = metadata
- resource.spec = spec
- end
- end
-
def as_json(opts = nil)
{
name: name,
@@ -56,6 +49,7 @@ module Gitlab
def metadata
meta = { name: name, namespace: namespace }
meta[:labels] = labels if labels
+ meta[:resourceVersion] = resource_version if defined?(resource_version)
meta
end
diff --git a/spec/frontend/boards/components/board_content_layout_spec.js b/spec/frontend/boards/components/board_content_layout_spec.js
new file mode 100644
index 00000000000..b6e260de8dd
--- /dev/null
+++ b/spec/frontend/boards/components/board_content_layout_spec.js
@@ -0,0 +1,66 @@
+import { mount } from '@vue/test-utils';
+import BoardContentLayout from '~/boards/components/board_content_layout.vue';
+
+const TestComponent = {
+ components: { BoardContentLayout },
+ template: `
+ <div>
+ <board-content-layout v-bind="$attrs">
+ <template v-slot:board-content-decoration="{ groupId }">
+ <p data-testid="child">{{ groupId }}</p>
+ </template>
+ </board-content-layout>
+ </div>
+ `,
+};
+
+describe('BoardContentLayout', () => {
+ let wrapper;
+ const groupId = 1;
+
+ const createComponent = props => {
+ wrapper = mount(TestComponent, {
+ propsData: {
+ lists: [],
+ canAdminList: true,
+ groupId,
+ disabled: false,
+ issueLinkBase: '',
+ rootPath: '',
+ boardId: '',
+ ...props,
+ },
+ });
+ };
+
+ afterEach(() => {
+ wrapper.destroy();
+ wrapper = null;
+ });
+
+ it('renders children in the slot', () => {
+ createComponent();
+
+ expect(wrapper.find('[data-testid="child"]').exists()).toBe(true);
+ });
+
+ it('renders groupId from the scoped slot', () => {
+ createComponent();
+
+ expect(wrapper.find('[data-testid="child"]').text()).toContain(groupId);
+ });
+
+ describe('when isSwimlanesOff', () => {
+ it('renders the correct class on the root div', () => {
+ createComponent({ isSwimlanesOff: true });
+
+ expect(wrapper.find('[data-testid="boards_list"]').classes()).toEqual([
+ 'boards-list',
+ 'gl-w-full',
+ 'gl-py-5',
+ 'gl-px-3',
+ 'gl-white-space-nowrap',
+ ]);
+ });
+ });
+});
diff --git a/spec/frontend/boards/components/board_content_spec.js b/spec/frontend/boards/components/board_content_spec.js
new file mode 100644
index 00000000000..5f8d34aa519
--- /dev/null
+++ b/spec/frontend/boards/components/board_content_spec.js
@@ -0,0 +1,40 @@
+import { mount } from '@vue/test-utils';
+import axios from 'axios';
+import MockAdapter from 'axios-mock-adapter';
+import BoardContent from '~/boards/components/board_content.vue';
+import BoardColumn from '~/boards/components/board_column.vue';
+import List from '~/boards/models/list';
+import { listObj } from '../mock_data';
+
+describe('BoardContent', () => {
+ let wrapper;
+ let mock;
+
+ const createComponent = () => {
+ wrapper = mount(BoardContent, {
+ propsData: {
+ lists: [new List(listObj)],
+ canAdminList: true,
+ groupId: 1,
+ disabled: false,
+ issueLinkBase: '',
+ rootPath: '',
+ boardId: '',
+ },
+ });
+ };
+
+ beforeEach(() => {
+ mock = new MockAdapter(axios);
+ });
+
+ afterEach(() => {
+ mock.restore();
+ });
+
+ it('finds BoardColumns', () => {
+ createComponent();
+
+ expect(wrapper.findAll(BoardColumn).length).toBe(1);
+ });
+});
diff --git a/spec/lib/gitlab/kubernetes/cilium_network_policy_spec.rb b/spec/lib/gitlab/kubernetes/cilium_network_policy_spec.rb
new file mode 100644
index 00000000000..9600a70a95d
--- /dev/null
+++ b/spec/lib/gitlab/kubernetes/cilium_network_policy_spec.rb
@@ -0,0 +1,217 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Kubernetes::CiliumNetworkPolicy do
+ let(:policy) do
+ described_class.new(
+ name: name,
+ namespace: namespace,
+ creation_timestamp: '2020-04-14T00:08:30Z',
+ endpoint_selector: endpoint_selector,
+ ingress: ingress,
+ egress: egress,
+ description: description
+ )
+ end
+
+ let(:resource) do
+ ::Kubeclient::Resource.new(
+ kind: partial_class_name,
+ apiVersion: "cilium.io/v2",
+ metadata: { name: name, namespace: namespace, resourceVersion: resource_version },
+ spec: { endpointSelector: endpoint_selector, ingress: ingress, egress: nil }
+ )
+ end
+
+ let(:name) { 'example-name' }
+ let(:namespace) { 'example-namespace' }
+ let(:endpoint_selector) { { matchLabels: { role: 'db' } } }
+ let(:description) { 'example-description' }
+ let(:partial_class_name) { described_class.name.split('::').last }
+ let(:resource_version) { 101 }
+ let(:ingress) do
+ [
+ {
+ fromEndpoints: [
+ { matchLabels: { project: 'myproject' } }
+ ]
+ }
+ ]
+ end
+
+ let(:egress) do
+ [
+ {
+ ports: [{ port: 5978 }]
+ }
+ ]
+ end
+
+ include_examples 'network policy common specs' do
+ let(:selector) { endpoint_selector}
+ let(:policy) do
+ described_class.new(
+ name: name,
+ namespace: namespace,
+ selector: selector,
+ ingress: ingress,
+ labels: labels,
+ resource_version: resource_version
+ )
+ end
+
+ let(:spec) { { endpointSelector: selector, ingress: ingress, egress: nil } }
+ let(:metadata) { { name: name, namespace: namespace, resourceVersion: resource_version } }
+ end
+
+ describe '#generate' do
+ subject { policy.generate }
+
+ it { is_expected.to eq(resource) }
+ end
+
+ describe '.from_yaml' do
+ let(:manifest) do
+ <<~POLICY
+ apiVersion: cilium.io/v2
+ kind: CiliumNetworkPolicy
+ metadata:
+ name: example-name
+ namespace: example-namespace
+ resourceVersion: 101
+ spec:
+ endpointSelector:
+ matchLabels:
+ role: db
+ ingress:
+ - fromEndpoints:
+ - matchLabels:
+ project: myproject
+ POLICY
+ end
+
+ subject { Gitlab::Kubernetes::CiliumNetworkPolicy.from_yaml(manifest)&.generate }
+
+ it { is_expected.to eq(resource) }
+
+ context 'with nil manifest' do
+ let(:manifest) { nil }
+
+ it { is_expected.to be_nil }
+ end
+
+ context 'with invalid manifest' do
+ let(:manifest) { "\tfoo: bar" }
+
+ it { is_expected.to be_nil }
+ end
+
+ context 'with manifest without metadata' do
+ let(:manifest) do
+ <<~POLICY
+ apiVersion: cilium.io/v2
+ kind: CiliumNetworkPolicy
+ spec:
+ endpointSelector:
+ matchLabels:
+ role: db
+ ingress:
+ - fromEndpoints:
+ matchLabels:
+ project: myproject
+ POLICY
+ end
+
+ it { is_expected.to be_nil }
+ end
+
+ context 'with manifest without spec' do
+ let(:manifest) do
+ <<~POLICY
+ apiVersion: cilium.io/v2
+ kind: CiliumNetworkPolicy
+ metadata:
+ name: example-name
+ namespace: example-namespace
+ POLICY
+ end
+
+ it { is_expected.to be_nil }
+ end
+
+ context 'with disallowed class' do
+ let(:manifest) do
+ <<~POLICY
+ apiVersion: cilium.io/v2
+ kind: CiliumNetworkPolicy
+ metadata:
+ name: example-name
+ namespace: example-namespace
+ creationTimestamp: 2020-04-14T00:08:30Z
+ spec:
+ endpointSelector:
+ matchLabels:
+ role: db
+ ingress:
+ - fromEndpoints:
+ matchLabels:
+ project: myproject
+ POLICY
+ end
+
+ it { is_expected.to be_nil }
+ end
+ end
+
+ describe '.from_resource' do
+ let(:resource) do
+ ::Kubeclient::Resource.new(
+ metadata: {
+ name: name, namespace: namespace, creationTimestamp: '2020-04-14T00:08:30Z',
+ labels: { app: 'foo' }, resourceVersion: resource_version
+ },
+ spec: { endpointSelector: endpoint_selector, ingress: ingress, egress: nil, labels: nil, description: nil }
+ )
+ end
+
+ let(:generated_resource) do
+ ::Kubeclient::Resource.new(
+ kind: partial_class_name,
+ apiVersion: "cilium.io/v2",
+ metadata: { name: name, namespace: namespace, resourceVersion: resource_version, labels: { app: 'foo' } },
+ spec: { endpointSelector: endpoint_selector, ingress: ingress, egress: nil }
+ )
+ end
+
+ subject { Gitlab::Kubernetes::CiliumNetworkPolicy.from_resource(resource)&.generate }
+
+ it { is_expected.to eq(generated_resource) }
+
+ context 'with nil resource' do
+ let(:resource) { nil }
+
+ it { is_expected.to be_nil }
+ end
+
+ context 'with resource without metadata' do
+ let(:resource) do
+ ::Kubeclient::Resource.new(
+ spec: { endpointSelector: endpoint_selector, ingress: ingress, egress: nil, labels: nil, description: nil }
+ )
+ end
+
+ it { is_expected.to be_nil }
+ end
+
+ context 'with resource without spec' do
+ let(:resource) do
+ ::Kubeclient::Resource.new(
+ metadata: { name: name, namespace: namespace, uid: '128cf288-7de4-11ea-aceb-42010a800089', resourceVersion: resource_version }
+ )
+ end
+
+ it { is_expected.to be_nil }
+ end
+ end
+end
diff --git a/spec/lib/gitlab/kubernetes/network_policy_spec.rb b/spec/lib/gitlab/kubernetes/network_policy_spec.rb
index f1730e400af..5d1dd5dec59 100644
--- a/spec/lib/gitlab/kubernetes/network_policy_spec.rb
+++ b/spec/lib/gitlab/kubernetes/network_policy_spec.rb
@@ -15,6 +15,13 @@ RSpec.describe Gitlab::Kubernetes::NetworkPolicy do
)
end
+ let(:resource) do
+ ::Kubeclient::Resource.new(
+ metadata: { name: name, namespace: namespace },
+ spec: { podSelector: pod_selector, policyTypes: %w(Ingress), ingress: ingress, egress: nil }
+ )
+ end
+
let(:name) { 'example-name' }
let(:namespace) { 'example-namespace' }
let(:pod_selector) { { matchLabels: { role: 'db' } } }
@@ -50,6 +57,13 @@ RSpec.describe Gitlab::Kubernetes::NetworkPolicy do
end
let(:spec) { { podSelector: selector, policyTypes: ["Ingress"], ingress: ingress, egress: nil } }
+ let(:metadata) { { name: name, namespace: namespace } }
+ end
+
+ describe '#generate' do
+ subject { policy.generate }
+
+ it { is_expected.to eq(resource) }
end
describe '.from_yaml' do
@@ -60,8 +74,6 @@ RSpec.describe Gitlab::Kubernetes::NetworkPolicy do
metadata:
name: example-name
namespace: example-namespace
- labels:
- app: foo
spec:
podSelector:
matchLabels:
@@ -76,13 +88,6 @@ RSpec.describe Gitlab::Kubernetes::NetworkPolicy do
POLICY
end
- let(:resource) do
- ::Kubeclient::Resource.new(
- metadata: { name: name, namespace: namespace, labels: { app: 'foo' } },
- spec: { podSelector: pod_selector, policyTypes: %w(Ingress), ingress: ingress, egress: nil }
- )
- end
-
subject { Gitlab::Kubernetes::NetworkPolicy.from_yaml(manifest)&.generate }
it { is_expected.to eq(resource) }
diff --git a/spec/support/shared_examples/lib/gitlab/kubernetes/network_policy_common_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/kubernetes/network_policy_common_shared_examples.rb
index 88d4bd45713..a3800f050bb 100644
--- a/spec/support/shared_examples/lib/gitlab/kubernetes/network_policy_common_shared_examples.rb
+++ b/spec/support/shared_examples/lib/gitlab/kubernetes/network_policy_common_shared_examples.rb
@@ -5,19 +5,6 @@ RSpec.shared_examples 'network policy common specs' do
let(:namespace) { 'example-namespace' }
let(:labels) { nil }
- describe 'generate' do
- let(:resource) do
- ::Kubeclient::Resource.new(
- metadata: { name: name, namespace: namespace },
- spec: spec
- )
- end
-
- subject { policy.generate }
-
- it { is_expected.to eq(resource) }
- end
-
describe 'as_json' do
let(:json_policy) do
{
@@ -26,7 +13,7 @@ RSpec.shared_examples 'network policy common specs' do
creation_timestamp: nil,
manifest: YAML.dump(
{
- metadata: { name: name, namespace: namespace },
+ metadata: metadata,
spec: spec
}.deep_stringify_keys
),