@oncehub/eslint-config 2.1.3 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Oncehub LTD
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,26 +1,59 @@
1
- Introduction
2
- =
3
- ESLint configuration for micro-services built using Node.js and TypeScript.
1
+ # eslint-config-oncehub
2
+
3
+ [![Build status](https://github.com/scheduleonce/eslint-config-oncehub/actions/workflows/node.js.yml/badge.svg)](https://github.com/scheduleonce/eslint-config-oncehub/actions) [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
4
+
5
+ > ESLint configuration for services built with Node.js and TypeScript.
4
6
 
5
7
  The configuration extends `@typescript-eslint/recommended`, `eslint-plugin-sonarjs`, `prettier` ESLint configurations.
6
8
 
9
+ It is compatible with ESlint >= v9 configuration format (flat config).
10
+
7
11
  ## Installation
8
- Using **NPM**
9
- ```sh
10
- npm i --save-dev @oncehub/eslint-config
11
- ```
12
12
 
13
- Using **Yarn**
13
+ To install this module, run the following command:
14
+
14
15
  ```sh
15
- yarn add --dev @oncehub/eslint-config
16
+ $ npm install --save-dev @oncehub/eslint-config
16
17
  ```
17
18
 
19
+ Note that it requires ESlint v9 and above.
20
+
18
21
  ## Usage
22
+
19
23
  In your `.eslintrc` file, put `@oncehub/eslint-config` under `extends` array as shown below.
24
+
20
25
  ```js
21
26
  module.exports = {
22
- 'extends': [
23
- '@oncehub/eslint-config'
24
- ]
27
+ extends: ["@oncehub/eslint-config"],
25
28
  };
26
- ```
29
+ ```
30
+
31
+ ## Development
32
+
33
+ ### Tests
34
+
35
+ Run tests via `npm test`.
36
+ The tests are comparing the eslint configuration against a previously saved snapshot of the rules so if you are adding or removing any rule, make sure to update the tests.
37
+
38
+ As a byproduct, the tests are also checking that the configuration is valid and all is okay with it.
39
+ You can also further debug the config via:
40
+
41
+ ```sh
42
+ $ npx eslint --debug -c index.js index.js
43
+ ```
44
+
45
+ To generate a new rules snapshot file:
46
+
47
+ ```sh
48
+ $ npx eslint --print-config index.js -c index.js > output.json
49
+ ```
50
+
51
+ Copy the rules from the output file into `test/rules-snapshot.js`
52
+
53
+ ### Deployment
54
+
55
+ Package is automatically published to npm when [creating a new release](.github/workflows/npm-publish.yml) on Github. Check out the release section in the repo. Read more about releases [here](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository).
56
+
57
+ ## License
58
+
59
+ This module is licensed under the MIT License. See the LICENSE file for details.
package/index.js CHANGED
@@ -1,47 +1,48 @@
1
- module.exports = {
2
- 'env': {
3
- 'es6': true,
4
- 'node': true,
1
+ import js from "@eslint/js";
2
+ import prettierConfig from "eslint-config-prettier";
3
+ import * as typescriptEslintPlugin from "@typescript-eslint/eslint-plugin";
4
+ import sonarjs from "eslint-plugin-sonarjs";
5
+
6
+ export default [
7
+ js.configs.recommended,
8
+ sonarjs.configs.recommended,
9
+ prettierConfig,
10
+ {
11
+ files: ["**/*.{js,ts,jsx,tsx}"],
12
+ languageOptions: {
13
+ globals: {
14
+ Atomics: "readonly",
15
+ SharedArrayBuffer: "readonly",
16
+ es6: true,
17
+ node: true,
18
+ },
19
+ parser: typescriptEslintPlugin.parser,
20
+ parserOptions: {
21
+ ecmaVersion: 2018,
22
+ sourceType: "module",
23
+ },
24
+ },
25
+ plugins: {
26
+ "@typescript-eslint": typescriptEslintPlugin,
27
+ // sonarjs,
28
+ },
29
+ rules: {
30
+ "@typescript-eslint/no-use-before-define": "off",
31
+ "@typescript-eslint/no-inferrable-types": "off",
32
+ "@typescript-eslint/no-unused-vars": "error",
33
+ "@typescript-eslint/interface-name-prefix": "off",
34
+ "@typescript-eslint/consistent-type-assertions": [
35
+ "error",
36
+ { assertionStyle: "angle-bracket" },
37
+ ],
38
+ "@typescript-eslint/no-explicit-any": "off",
39
+ "@typescript-eslint/explicit-function-return-type": "off",
40
+ },
5
41
  },
6
- 'extends': [
7
- 'plugin:@typescript-eslint/recommended',
8
- 'plugin:sonarjs/recommended',
9
- 'prettier'
10
- ],
11
- 'globals': {
12
- 'Atomics': 'readonly',
13
- 'SharedArrayBuffer': 'readonly',
42
+ {
43
+ files: ["**/*(specs|tests)/**", "**/*.spec.ts"],
44
+ rules: {
45
+ "@typescript-eslint/no-empty-function": "off",
46
+ },
14
47
  },
15
- 'parser': '@typescript-eslint/parser',
16
- 'parserOptions': {
17
- 'ecmaVersion': 2018,
18
- 'sourceType': 'module',
19
- },
20
- 'plugins': [
21
- '@typescript-eslint',
22
- 'sonarjs'
23
- ],
24
- 'overrides': [
25
- {
26
- 'files': ['**/*(specs|tests)/**', '**/*.spec.ts'],
27
- 'rules': {
28
- '@typescript-eslint/no-empty-function': 'off',
29
- 'sonarjs/no-identical-functions': 'off',
30
- 'sonarjs/no-duplicate-string': 'off'
31
- }
32
- }
33
- ],
34
- 'rules': {
35
- '@typescript-eslint/no-use-before-define': 'off',
36
- '@typescript-eslint/no-inferrable-types': 'off',
37
- '@typescript-eslint/explicit-function-return-type': 'error',
38
- '@typescript-eslint/no-unused-vars': 'error',
39
- '@typescript-eslint/no-explicit-any': 'error',
40
- '@typescript-eslint/interface-name-prefix': 'off',
41
- '@typescript-eslint/consistent-type-assertions': ['error', {
42
- assertionStyle: 'angle-bracket'
43
- }],
44
- '@typescript-eslint/no-explicit-any': 'off',
45
- '@typescript-eslint/explicit-function-return-type': 'off'
46
- }
47
- };
48
+ ];
package/package.json CHANGED
@@ -1,21 +1,26 @@
1
1
  {
2
2
  "name": "@oncehub/eslint-config",
3
- "version": "2.1.3",
3
+ "version": "3.0.0",
4
4
  "description": "ESLint configuration for micro-services built using Node.js and TypeScript",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
8
- "package": "npm pack"
7
+ "test": "node test"
9
8
  },
9
+ "engines": {
10
+ "node": ">=18"
11
+ },
12
+ "type": "module",
10
13
  "author": "Rajat Saxena <rajat.saxena@oncehub.com>",
11
- "license": "ISC",
14
+ "license": "MIT",
12
15
  "dependencies": {
13
- "@typescript-eslint/eslint-plugin": "^5.6.0",
14
- "@typescript-eslint/parser": "^5.6.0",
15
- "eslint": "^8.4.1",
16
- "eslint-config-prettier": "^8.3.0",
17
- "eslint-plugin-sonarjs": "^0.11.0",
18
- "typescript": "^4.1.3"
16
+ "@eslint/js": "^9.14.0",
17
+ "@types/eslint__js": "^8.42.3",
18
+ "eslint-config-prettier": "^9.1.0",
19
+ "eslint-plugin-sonarjs": "^2.0.4",
20
+ "typescript-eslint": "^8.13.0"
21
+ },
22
+ "peerDependencies": {
23
+ "eslint": ">= 9"
19
24
  },
20
25
  "repository": {
21
26
  "type": "git",
@@ -24,5 +29,10 @@
24
29
  "bugs": {
25
30
  "url": "https://github.com/scheduleonce/eslint-config-oncehub/issues"
26
31
  },
27
- "homepage": "https://github.com/scheduleonce/eslint-config-oncehub#readme"
32
+ "homepage": "https://github.com/scheduleonce/eslint-config-oncehub#readme",
33
+ "files": [
34
+ "index.js",
35
+ "README.md",
36
+ "LICENSE"
37
+ ]
28
38
  }
@@ -1,72 +0,0 @@
1
- # For most projects, this workflow file will not need changing; you simply need
2
- # to commit it to your repository.
3
- #
4
- # You may wish to alter this file to override the set of languages analyzed,
5
- # or to provide custom queries or build logic.
6
- #
7
- # ******** NOTE ********
8
- # We have attempted to detect the languages in your repository. Please check
9
- # the `language` matrix defined below to confirm you have the correct set of
10
- # supported CodeQL languages.
11
- #
12
- name: "CodeQL"
13
-
14
- on:
15
- push:
16
- branches: [ master ]
17
- pull_request:
18
- # The branches below must be a subset of the branches above
19
- branches: [ master ]
20
- schedule:
21
- - cron: '19 10 * * 0'
22
-
23
- jobs:
24
- analyze:
25
- name: Analyze
26
- runs-on: ubuntu-latest
27
- permissions:
28
- actions: read
29
- contents: read
30
- security-events: write
31
-
32
- strategy:
33
- fail-fast: false
34
- matrix:
35
- language: [ 'javascript' ]
36
- # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
- # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38
-
39
- steps:
40
- - name: Checkout repository
41
- uses: actions/checkout@v3
42
-
43
- # Initializes the CodeQL tools for scanning.
44
- - name: Initialize CodeQL
45
- uses: github/codeql-action/init@v2
46
- with:
47
- languages: ${{ matrix.language }}
48
- # If you wish to specify custom queries, you can do so here or in a config file.
49
- # By default, queries listed here will override any specified in a config file.
50
- # Prefix the list here with "+" to use these queries and those in the config file.
51
-
52
- # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53
- # queries: security-extended,security-and-quality
54
-
55
-
56
- # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57
- # If this step fails, then you should remove it and run the build manually (see below)
58
- - name: Autobuild
59
- uses: github/codeql-action/autobuild@v2
60
-
61
- # ℹ️ Command-line programs to run using the OS shell.
62
- # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63
-
64
- # If the Autobuild fails above, remove it and uncomment the following three lines.
65
- # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66
-
67
- # - run: |
68
- # echo "Run, Build Application using script"
69
- # ./location_of_script_within_repo/buildscript.sh
70
-
71
- - name: Perform CodeQL Analysis
72
- uses: github/codeql-action/analyze@v2
@@ -1,11 +0,0 @@
1
- apiVersion: kpt.dev/v1alpha1
2
- kind: Kptfile
3
- metadata:
4
- name: jenkins-x
5
- upstream:
6
- type: git
7
- git:
8
- commit: 4b44dcda8284ebcecf7eed34c00f23b54e7a9d27
9
- repo: https://github.com/scheduleonce/jx3-pipeline-catalog
10
- directory: /packs/eslint-config-oncehub/.lighthouse/jenkins-x
11
- ref: master
@@ -1,278 +0,0 @@
1
- apiVersion: tekton.dev/v1beta1
2
- kind: PipelineRun
3
- metadata:
4
- creationTimestamp: null
5
- labels:
6
- branch: master
7
- build: "1"
8
- jenkins.io/pipelineType: build
9
- owner: jenkins-x-quickstarts
10
- repository: eslint-config-oncehub
11
- name: eslint-pr
12
- spec:
13
- pipelineSpec:
14
- params:
15
- - description: the unique build number
16
- name: BUILD_ID
17
- type: string
18
- - description: the name of the job which is the trigger context name
19
- name: JOB_NAME
20
- type: string
21
- - description: the specification of the job
22
- name: JOB_SPEC
23
- type: string
24
- - description: 'the kind of job: postsubmit or presubmit'
25
- name: JOB_TYPE
26
- type: string
27
- - default: master
28
- description: the base git reference of the pull request
29
- name: PULL_BASE_REF
30
- type: string
31
- - description: the git sha of the base of the pull request
32
- name: PULL_BASE_SHA
33
- type: string
34
- - default: ""
35
- description: git pull request number
36
- name: PULL_NUMBER
37
- type: string
38
- - default: ""
39
- description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
40
- name: PULL_PULL_REF
41
- type: string
42
- - default: master
43
- description: git revision to checkout (branch, tag, sha, ref…)
44
- name: PULL_PULL_SHA
45
- type: string
46
- - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
47
- name: PULL_REFS
48
- type: string
49
- - description: git repository name
50
- name: REPO_NAME
51
- type: string
52
- - description: git repository owner (user or organisation)
53
- name: REPO_OWNER
54
- type: string
55
- - description: git url to clone
56
- name: REPO_URL
57
- type: string
58
- tasks:
59
- - name: eslint-pr
60
- params:
61
- - name: BUILD_ID
62
- value: $(params.BUILD_ID)
63
- - name: JOB_NAME
64
- value: $(params.JOB_NAME)
65
- - name: JOB_SPEC
66
- value: $(params.JOB_SPEC)
67
- - name: JOB_TYPE
68
- value: $(params.JOB_TYPE)
69
- - name: PULL_BASE_REF
70
- value: $(params.PULL_BASE_REF)
71
- - name: PULL_BASE_SHA
72
- value: $(params.PULL_BASE_SHA)
73
- - name: PULL_NUMBER
74
- value: $(params.PULL_NUMBER)
75
- - name: PULL_PULL_REF
76
- value: $(params.PULL_PULL_REF)
77
- - name: PULL_PULL_SHA
78
- value: $(params.PULL_PULL_SHA)
79
- - name: PULL_REFS
80
- value: $(params.PULL_REFS)
81
- - name: REPO_NAME
82
- value: $(params.REPO_NAME)
83
- - name: REPO_OWNER
84
- value: $(params.REPO_OWNER)
85
- - name: REPO_URL
86
- value: $(params.REPO_URL)
87
- resources: {}
88
- taskSpec:
89
- params:
90
- - description: git url to clone
91
- name: REPO_URL
92
- type: string
93
- - default: master
94
- description: git revision to checkout (branch, tag, sha, ref…)
95
- name: PULL_PULL_SHA
96
- type: string
97
- - default: source
98
- description: subdirectory inside of /workspace to clone the git repo
99
- name: subdirectory
100
- type: string
101
- - description: the unique build number
102
- name: BUILD_ID
103
- type: string
104
- - description: the name of the job which is the trigger context name
105
- name: JOB_NAME
106
- type: string
107
- - description: the specification of the job
108
- name: JOB_SPEC
109
- type: string
110
- - description: 'the kind of job: postsubmit or presubmit'
111
- name: JOB_TYPE
112
- type: string
113
- - default: master
114
- description: the base git reference of the pull request
115
- name: PULL_BASE_REF
116
- type: string
117
- - description: the git sha of the base of the pull request
118
- name: PULL_BASE_SHA
119
- type: string
120
- - default: ""
121
- description: git pull request number
122
- name: PULL_NUMBER
123
- type: string
124
- - default: ""
125
- description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
126
- name: PULL_PULL_REF
127
- type: string
128
- - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
129
- name: PULL_REFS
130
- type: string
131
- - description: git repository name
132
- name: REPO_NAME
133
- type: string
134
- - description: git repository owner (user or organisation)
135
- name: REPO_OWNER
136
- type: string
137
- stepTemplate:
138
- env:
139
- - name: BUILD_ID
140
- value: $(params.BUILD_ID)
141
- - name: JOB_NAME
142
- value: $(params.JOB_NAME)
143
- - name: JOB_SPEC
144
- value: $(params.JOB_SPEC)
145
- - name: JOB_TYPE
146
- value: $(params.JOB_TYPE)
147
- - name: PULL_BASE_REF
148
- value: $(params.PULL_BASE_REF)
149
- - name: PULL_BASE_SHA
150
- value: $(params.PULL_BASE_SHA)
151
- - name: PULL_NUMBER
152
- value: $(params.PULL_NUMBER)
153
- - name: PULL_PULL_REF
154
- value: $(params.PULL_PULL_REF)
155
- - name: PULL_PULL_SHA
156
- value: $(params.PULL_PULL_SHA)
157
- - name: PULL_REFS
158
- value: $(params.PULL_REFS)
159
- - name: REPO_NAME
160
- value: $(params.REPO_NAME)
161
- - name: REPO_OWNER
162
- value: $(params.REPO_OWNER)
163
- - name: REPO_URL
164
- value: $(params.REPO_URL)
165
- - name: DOCKER_REGISTRY
166
- valueFrom:
167
- configMapKeyRef:
168
- name: jenkins-x-docker-registry
169
- key: docker.registry
170
- - name: DOCKER_REGISTRY_ORG
171
- value: "kubernetes"
172
- name: ""
173
- resources:
174
- requests:
175
- cpu: 100m
176
- memory: 250Mi
177
- volumeMounts:
178
- - mountPath: /home/jenkins
179
- name: workspace-volume
180
- - mountPath: /etc/podinfo
181
- name: podinfo
182
- readOnly: true
183
- - mountPath: /merge-disabled
184
- name: merge-disabled
185
- readOnly: true
186
- workingDir: /workspace/source
187
- steps:
188
- - script: |
189
- #!/usr/bin/env bash
190
- RED='\033[0;31m'
191
- NC='\033[0m' # No Color
192
- mergeDisabled=$(cat "/merge-disabled/MERGE_DISABLED")
193
- if [[ $(params.PULL_BASE_REF) == "qa" && $mergeDisabled == "true" ]]; then
194
- echo -e "\n ${RED}Merge is temporarly disabled for $(params.PULL_BASE_REF) branch...Please close/reopen the PR's once merge is enabled...${NC}"
195
- exit 1;
196
- fi
197
- image: ghcr.io/jenkins-x/builder-jx:2.1.155-779
198
- name: check-merge-disabled
199
- - args:
200
- - -c
201
- - 'mkdir -p $HOME; git config --global --add user.name ${GIT_AUTHOR_NAME:-so-integrations}; git config --global --add user.email ${GIT_AUTHOR_EMAIL:-so-integrations@oncehub.com}; git config --global credential.helper store; git clone $(params.REPO_URL) $(params.subdirectory); echo cloned url: $(params.REPO_URL) to dir: $(params.subdirectory);'
202
- command:
203
- - /bin/sh
204
- image: ghcr.io/jenkins-x/builder-jx:2.1.155-779
205
- name: git-clone
206
- resources: {}
207
- workingDir: /workspace
208
- - args:
209
- - '[ -d /builder/home ] || mkdir -p /builder && ln -s /tekton/home /builder/home'
210
- command:
211
- - /bin/sh
212
- - -c
213
- image: ghcr.io/jenkins-x/builder-jx:2.1.155-779
214
- name: setup-builder-home
215
- resources: {}
216
- - args:
217
- - step
218
- - git
219
- - merge
220
- - --verbose
221
- - --baseSHA
222
- - $(params.PULL_BASE_SHA)
223
- - --sha
224
- - $(params.PULL_PULL_SHA)
225
- - --baseBranch
226
- - $(params.PULL_BASE_REF)
227
- command:
228
- - jx
229
- image: ghcr.io/jenkins-x/builder-jx:2.1.155-779
230
- name: git-merge
231
- resources: {}
232
- - args:
233
- - -c
234
- - |
235
- /bin/bash <<'EOF'
236
- # Script to evaluate image tag.
237
- branchName=$PULL_BASE_REF
238
- echo "eval tag script for $branchName branch..."
239
- teamBranchReg="team\/.*"
240
- storyBranchReg=".*\/story\/.*"
241
- if [[ $branchName =~ $teamBranchReg ]]; then
242
- tag=$(echo $branchName | sed 's/team\//''/g' )
243
- elif [[ $branchName =~ $storyBranchReg ]]; then
244
- tag=$(echo $branchName | sed 's/\/.*/''/g' )
245
- elif [[ $branchName == "master" ]]; then
246
- tag="prod"
247
- elif [[ $branchName == "qa" || $branchName == "staging-app2" ]]; then
248
- tag=$branchName
249
- else
250
- tag="${branchName//\//'-'}"
251
- fi
252
- echo $tag > VERSION
253
- EOF
254
- command:
255
- - /bin/sh
256
- image: ghcr.io/jenkins-x/builder-go
257
- name: pr-version
258
- resources: {}
259
- volumes:
260
- - emptyDir: {}
261
- name: workspace-volume
262
- - downwardAPI:
263
- items:
264
- - fieldRef:
265
- fieldPath: metadata.labels
266
- path: labels
267
- name: podinfo
268
- - name: merge-disabled
269
- secret:
270
- secretName: merge-disabled
271
- podTemplate:
272
- ImagePullSecrets:
273
- - name: tekton-container-registry-auth
274
- hostNetwork: false
275
- schedulerName: ""
276
- serviceAccountName: tekton-bot
277
- timeout: 240h0m0s
278
- status: {}
@@ -1,269 +0,0 @@
1
- apiVersion: tekton.dev/v1beta1
2
- kind: PipelineRun
3
- metadata:
4
- creationTimestamp: null
5
- labels:
6
- branch: master
7
- build: "1"
8
- jenkins.io/pipelineType: build
9
- owner: jenkins-x-quickstarts
10
- repository: eslint-config-oncehub
11
- name: eslint
12
- spec:
13
- pipelineSpec:
14
- params:
15
- - description: the unique build number
16
- name: BUILD_ID
17
- type: string
18
- - description: the name of the job which is the trigger context name
19
- name: JOB_NAME
20
- type: string
21
- - description: the specification of the job
22
- name: JOB_SPEC
23
- type: string
24
- - description: 'the kind of job: postsubmit or presubmit'
25
- name: JOB_TYPE
26
- type: string
27
- - default: master
28
- description: the base git reference of the pull request
29
- name: PULL_BASE_REF
30
- type: string
31
- - description: the git sha of the base of the pull request
32
- name: PULL_BASE_SHA
33
- type: string
34
- - default: ""
35
- description: git pull request number
36
- name: PULL_NUMBER
37
- type: string
38
- - default: ""
39
- description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
40
- name: PULL_PULL_REF
41
- type: string
42
- - default: master
43
- description: git revision to checkout (branch, tag, sha, ref…)
44
- name: PULL_PULL_SHA
45
- type: string
46
- - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
47
- name: PULL_REFS
48
- type: string
49
- - description: git repository name
50
- name: REPO_NAME
51
- type: string
52
- - description: git repository owner (user or organisation)
53
- name: REPO_OWNER
54
- type: string
55
- - description: git url to clone
56
- name: REPO_URL
57
- type: string
58
- tasks:
59
- - name: release
60
- params:
61
- - name: BUILD_ID
62
- value: $(params.BUILD_ID)
63
- - name: JOB_NAME
64
- value: $(params.JOB_NAME)
65
- - name: JOB_SPEC
66
- value: $(params.JOB_SPEC)
67
- - name: JOB_TYPE
68
- value: $(params.JOB_TYPE)
69
- - name: PULL_BASE_REF
70
- value: $(params.PULL_BASE_REF)
71
- - name: PULL_BASE_SHA
72
- value: $(params.PULL_BASE_SHA)
73
- - name: PULL_NUMBER
74
- value: $(params.PULL_NUMBER)
75
- - name: PULL_PULL_REF
76
- value: $(params.PULL_PULL_REF)
77
- - name: PULL_PULL_SHA
78
- value: $(params.PULL_PULL_SHA)
79
- - name: PULL_REFS
80
- value: $(params.PULL_REFS)
81
- - name: REPO_NAME
82
- value: $(params.REPO_NAME)
83
- - name: REPO_OWNER
84
- value: $(params.REPO_OWNER)
85
- - name: REPO_URL
86
- value: $(params.REPO_URL)
87
- resources: {}
88
- taskSpec:
89
- params:
90
- - description: git url to clone
91
- name: REPO_URL
92
- type: string
93
- - default: master
94
- description: git revision to checkout (branch, tag, sha, ref…)
95
- name: PULL_PULL_SHA
96
- type: string
97
- - default: source
98
- description: subdirectory inside of /workspace to clone the git repo
99
- name: subdirectory
100
- type: string
101
- - description: the unique build number
102
- name: BUILD_ID
103
- type: string
104
- - description: the name of the job which is the trigger context name
105
- name: JOB_NAME
106
- type: string
107
- - description: the specification of the job
108
- name: JOB_SPEC
109
- type: string
110
- - description: 'the kind of job: postsubmit or presubmit'
111
- name: JOB_TYPE
112
- type: string
113
- - default: master
114
- description: the base git reference of the pull request
115
- name: PULL_BASE_REF
116
- type: string
117
- - description: the git sha of the base of the pull request
118
- name: PULL_BASE_SHA
119
- type: string
120
- - default: ""
121
- description: git pull request number
122
- name: PULL_NUMBER
123
- type: string
124
- - default: ""
125
- description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
126
- name: PULL_PULL_REF
127
- type: string
128
- - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
129
- name: PULL_REFS
130
- type: string
131
- - description: git repository name
132
- name: REPO_NAME
133
- type: string
134
- - description: git repository owner (user or organisation)
135
- name: REPO_OWNER
136
- type: string
137
- stepTemplate:
138
- env:
139
- - name: BUILD_ID
140
- value: $(params.BUILD_ID)
141
- - name: JOB_NAME
142
- value: $(params.JOB_NAME)
143
- - name: JOB_SPEC
144
- value: $(params.JOB_SPEC)
145
- - name: JOB_TYPE
146
- value: $(params.JOB_TYPE)
147
- - name: PULL_BASE_REF
148
- value: $(params.PULL_BASE_REF)
149
- - name: PULL_BASE_SHA
150
- value: $(params.PULL_BASE_SHA)
151
- - name: PULL_NUMBER
152
- value: $(params.PULL_NUMBER)
153
- - name: PULL_PULL_REF
154
- value: $(params.PULL_PULL_REF)
155
- - name: PULL_PULL_SHA
156
- value: $(params.PULL_PULL_SHA)
157
- - name: PULL_REFS
158
- value: $(params.PULL_REFS)
159
- - name: REPO_NAME
160
- value: $(params.REPO_NAME)
161
- - name: REPO_OWNER
162
- value: $(params.REPO_OWNER)
163
- - name: REPO_URL
164
- value: $(params.REPO_URL)
165
- - name: DOCKER_REGISTRY
166
- valueFrom:
167
- configMapKeyRef:
168
- name: jenkins-x-docker-registry
169
- key: docker.registry
170
- - name: DOCKER_REGISTRY_ORG
171
- value: "kubernetes"
172
- name: ""
173
- resources:
174
- requests:
175
- cpu: 100m
176
- memory: 250Mi
177
- volumeMounts:
178
- - mountPath: /home/jenkins
179
- name: workspace-volume
180
- - mountPath: /etc/podinfo
181
- name: podinfo
182
- readOnly: true
183
- - mountPath: /etc/npm-cred
184
- name: npm-cred
185
- readOnly: true
186
- workingDir: /workspace/source
187
- steps:
188
- - script: |
189
- #!/bin/bash
190
- # Check for already running release pipeline and wait for them to get finished(if any) before continuing.
191
- ENV=$(echo $PULL_BASE_REF | cut -d '/' -f 2)
192
- echo "Checking already running release pipelines for ${REPO_NAME}'s service on $ENV...";
193
- CURRENT_BUILD_NO=$(jx get build pod | grep $HOSTNAME | awk '{print $4}');
194
- checkAlreadyRunningPipelines() {
195
- ALREADY_RUNNING_PIPELINES_COUNT=$(jx get build pods | awk -v REPO_NAME="$REPO_NAME" -v JOB_NAME="$JOB_NAME" -v ENV="$ENV" -v CURRENT_BUILD_NO="$CURRENT_BUILD_NO" '{if($2==REPO_NAME && $5==JOB_NAME && $3==ENV && $4<CURRENT_BUILD_NO && $7~"Pending|Running") {print $0}}' | wc -l);
196
- if [[ $ALREADY_RUNNING_PIPELINES_COUNT != 0 ]]; then
197
- echo "Waiting for already running ${REPO_NAME}'s release pipelines to get finished before continuing to avoid race conditon on $ENV..."
198
- sleep 1m;
199
- checkAlreadyRunningPipelines
200
- fi
201
- }
202
- checkAlreadyRunningPipelines
203
- image: ghcr.io/jenkins-x/jx-cli:3.1.299
204
- name: handle-race-condition
205
- resources: {}
206
- - args:
207
- - -c
208
- - 'mkdir -p $HOME; git config --global --add user.name ${GIT_AUTHOR_NAME:-so-integrations};
209
- git config --global --add user.email ${GIT_AUTHOR_EMAIL:-so-integrations@oncehub.com};
210
- git config --global credential.helper store; git clone $(params.REPO_URL)
211
- $(params.subdirectory); echo cloned url: $(params.REPO_URL) to dir: $(params.subdirectory);'
212
- command:
213
- - /bin/sh
214
- image: ghcr.io/jenkins-x/builder-jx:2.1.155-779
215
- name: git-clone
216
- resources: {}
217
- workingDir: /workspace
218
- - args:
219
- - step
220
- - git
221
- - merge
222
- - --verbose
223
- - --baseSHA
224
- - $(params.PULL_BASE_SHA)
225
- - --sha
226
- - $(params.PULL_BASE_REF)
227
- - --baseBranch
228
- - $(params.PULL_BASE_REF)
229
- command:
230
- - jx
231
- image: ghcr.io/jenkins-x/builder-jx:2.1.155-779
232
- name: git-merge
233
- resources: {}
234
- - args:
235
- - '[ -d /builder/home ] || mkdir -p /builder && ln -s /tekton/home /builder/home'
236
- command:
237
- - /bin/sh
238
- - -c
239
- image: ghcr.io/jenkins-x/builder-jx:2.1.155-779
240
- name: setup-builder-home
241
- resources: {}
242
- - args:
243
- - sh deploy.sh $PULL_BASE_REF
244
- command:
245
- - /bin/sh
246
- - -c
247
- image: dockeronce.azurecr.io/cloudbees/nodejs:sonf-v16-latest
248
- name: package-build-publish
249
- resources: {}
250
- volumes:
251
- - emptyDir: {}
252
- name: workspace-volume
253
- - downwardAPI:
254
- items:
255
- - fieldRef:
256
- fieldPath: metadata.labels
257
- path: labels
258
- name: podinfo
259
- - name: npm-cred
260
- secret:
261
- secretName: npm-cred
262
- podTemplate:
263
- ImagePullSecrets:
264
- - name: tekton-container-registry-auth
265
- hostNetwork: false
266
- schedulerName: ""
267
- serviceAccountName: tekton-bot
268
- timeout: 240h0m0s
269
- status: {}
@@ -1,19 +0,0 @@
1
- apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
2
- kind: TriggerConfig
3
- spec:
4
- presubmits:
5
- - name: pr
6
- context: "pr"
7
- always_run: true
8
- optional: false
9
- trigger: "/test"
10
- rerun_command: "/retest"
11
- source: "pullrequest.yaml"
12
- postsubmits:
13
- - name: release
14
- context: "release"
15
- source: "release.yaml"
16
- branches:
17
- - ^(master)$
18
- - ^(qa)$
19
- - ^(team\/.+)$
package/OWNERS DELETED
@@ -1,4 +0,0 @@
1
- approvers:
2
- - developers
3
- reviewers:
4
- - developers
package/OWNERS_ALIASES DELETED
@@ -1,31 +0,0 @@
1
- aliases:
2
- developers:
3
- - so-nagender
4
- - so-ravindra
5
- - somanwal
6
- - avik-so
7
- - mderazon
8
- - so-abahadur
9
- - amanpreetSO
10
- - AmitPandeyScheduleonce
11
- - ashishsatiSO
12
- - SO-ashusrivastava
13
- - bharatsinghoh
14
- - giladgoraly
15
- - sohimanshu
16
- - so-kaushal
17
- - nalingarg
18
- - so-sdhawan
19
- - so-shekhar
20
- - ShivamKe
21
- - umeshchaudhary
22
- - ushankar208
23
- - vaibhavso
24
- - vinaykumar01
25
- - yoramwso
26
- - piyush-so
27
- - sumitsharma22
28
- - yuktiarora
29
- - aakash-ravi
30
- - rameshwarverma
31
- - so-hvats
package/deploy.sh DELETED
@@ -1,19 +0,0 @@
1
- #!/bin/sh
2
- set -e
3
-
4
- node package-deploy/npm-login.js $(cat "/etc/npm-cred/NPM_AUTH_TOKEN")
5
- npm whoami
6
- npm i
7
- chown root:root .
8
- npm run package
9
- filename="$(npm pack --dry-run | tail -n 1)"
10
- echo "$1"
11
-
12
- if [[ "$1" == "qa" ]] || [[ "$1" == "master" ]] || [[ "$1" == "staging" ]] || [[ "$1" == "staging-app2" ]]
13
- then
14
- npm publish $filename --registry=https://registry.npmjs.org/
15
- else
16
- npm publish --tag beta $filename --registry=https://registry.npmjs.org/
17
- fi
18
-
19
- echo "$filename package pushed to NPM successfully"
@@ -1,14 +0,0 @@
1
- let fs = require('fs');
2
- let path = require('path');
3
-
4
- let token = '';
5
-
6
- process.argv.forEach(function(val, index, array) {
7
- if (index == 2) token = val;
8
- });
9
-
10
- let registry = '//registry.npmjs.org/';
11
-
12
- var configPath = configPath ? configPath : path.join(__dirname, '../', '.npmrc');
13
-
14
- fs.writeFile(configPath, `${registry}:_authToken=${token}` + '\n', (err, message) => { if(err){ console.log(err , message)}});