Compare commits
	
		
			14 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 955e3d0dbe | |||
| 702ae8bed8 | |||
| b6f0723b75 | |||
| 8a2fb30e59 | |||
| 95b4030120 | |||
| 5c77cfbdc2 | |||
| 5ea42320a9 | |||
| d07ebfc9c6 | |||
| bbb5718184 | |||
| 0d8b54637c | |||
| e51b2e28b9 | |||
| f767140cc8 | |||
| 0d4d69f072 | |||
| a3e628c43f | 
							
								
								
									
										66
									
								
								.gitea/workflows/default_nottags.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								.gitea/workflows/default_nottags.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,66 @@ | ||||
| name: Default (not tags) | ||||
|  | ||||
| on: | ||||
|   push: | ||||
|     tags-ignore: | ||||
|       - '**' | ||||
|  | ||||
| env: | ||||
|   IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci | ||||
|   NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}} | ||||
|   NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}} | ||||
|   NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}} | ||||
|   NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}} | ||||
|  | ||||
| jobs: | ||||
|  | ||||
|   security: | ||||
|     runs-on: ubuntu-latest | ||||
|     continue-on-error: true | ||||
|     container: | ||||
|       image: ${{ env.IMAGE }} | ||||
|  | ||||
|     steps: | ||||
|     - uses: actions/checkout@v3 | ||||
|  | ||||
|     - name: Install pnpm and npmci | ||||
|       run: | | ||||
|         pnpm install -g pnpm | ||||
|         pnpm install -g @shipzone/npmci | ||||
|  | ||||
|     - name: Run npm prepare | ||||
|       run: npmci npm prepare | ||||
|  | ||||
|     - name: Audit production dependencies | ||||
|       run: | | ||||
|         npmci command npm config set registry https://registry.npmjs.org | ||||
|         npmci command pnpm audit --audit-level=high --prod | ||||
|       continue-on-error: true | ||||
|  | ||||
|     - name: Audit development dependencies | ||||
|       run: | | ||||
|         npmci command npm config set registry https://registry.npmjs.org | ||||
|         npmci command pnpm audit --audit-level=high --dev | ||||
|       continue-on-error: true | ||||
|  | ||||
|   test: | ||||
|     if: ${{ always() }} | ||||
|     needs: security | ||||
|     runs-on: ubuntu-latest | ||||
|     container: | ||||
|       image: ${{ env.IMAGE }} | ||||
|  | ||||
|     steps: | ||||
|     - uses: actions/checkout@v3 | ||||
|  | ||||
|     - name: Test stable | ||||
|       run: | | ||||
|         npmci node install stable | ||||
|         npmci npm install | ||||
|         npmci npm test | ||||
|  | ||||
|     - name: Test build | ||||
|       run: | | ||||
|         npmci node install stable | ||||
|         npmci npm install | ||||
|         npmci npm build | ||||
							
								
								
									
										109
									
								
								.gitea/workflows/default_tags.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								.gitea/workflows/default_tags.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
| name: Default (tags) | ||||
|  | ||||
| on: | ||||
|   push: | ||||
|     tags: | ||||
|       - '*' | ||||
|  | ||||
| env: | ||||
|   IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci | ||||
|   NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}} | ||||
|   NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}} | ||||
|   NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}} | ||||
|   NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}} | ||||
|  | ||||
| jobs: | ||||
|  | ||||
|   security: | ||||
|     runs-on: ubuntu-latest | ||||
|     continue-on-error: true | ||||
|     container: | ||||
|       image: ${{ env.IMAGE }} | ||||
|  | ||||
|     steps: | ||||
|     - uses: actions/checkout@v3 | ||||
|  | ||||
|     - name: Install pnpm and npmci | ||||
|       run: | | ||||
|         pnpm install -g pnpm | ||||
|         pnpm install -g @shipzone/npmci | ||||
|  | ||||
|     - name: Run npm prepare | ||||
|       run: npmci npm prepare | ||||
|  | ||||
|     - name: Audit production dependencies | ||||
|       run: | | ||||
|         npmci command npm config set registry https://registry.npmjs.org | ||||
|         npmci command pnpm audit --audit-level=high --prod | ||||
|       continue-on-error: true | ||||
|  | ||||
|     - name: Audit development dependencies | ||||
|       run: | | ||||
|         npmci command npm config set registry https://registry.npmjs.org | ||||
|         npmci command pnpm audit --audit-level=high --dev | ||||
|       continue-on-error: true | ||||
|  | ||||
|   test: | ||||
|     if: ${{ always() }} | ||||
|     needs: security | ||||
|     runs-on: ubuntu-latest | ||||
|     container: | ||||
|       image: ${{ env.IMAGE }} | ||||
|  | ||||
|     steps: | ||||
|     - uses: actions/checkout@v3 | ||||
|  | ||||
|     - name: Test stable | ||||
|       run: | | ||||
|         npmci node install stable | ||||
|         npmci npm install | ||||
|         npmci npm test | ||||
|  | ||||
|     - name: Test build | ||||
|       run: | | ||||
|         npmci node install stable | ||||
|         npmci npm install | ||||
|         npmci npm build | ||||
|  | ||||
|   release: | ||||
|     needs: test | ||||
|     if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | ||||
|     runs-on: ubuntu-latest | ||||
|     container: | ||||
|       image: ${{ env.IMAGE }} | ||||
|  | ||||
|     steps: | ||||
|     - uses: actions/checkout@v3 | ||||
|  | ||||
|     - name: Release | ||||
|       run: | | ||||
|         npmci node install stable | ||||
|         npmci npm publish | ||||
|  | ||||
|   metadata: | ||||
|     needs: test | ||||
|     if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | ||||
|     runs-on: ubuntu-latest | ||||
|     container: | ||||
|       image: ${{ env.IMAGE }} | ||||
|     continue-on-error: true | ||||
|  | ||||
|     steps: | ||||
|     - uses: actions/checkout@v3 | ||||
|  | ||||
|     - name: Code quality | ||||
|       run: | | ||||
|         npmci command npm install -g typescript | ||||
|         npmci npm prepare | ||||
|         npmci npm install | ||||
|  | ||||
|     - name: Trigger | ||||
|       run: npmci trigger | ||||
|  | ||||
|     - name: Build docs and upload artifacts | ||||
|       run: | | ||||
|         npmci node install stable | ||||
|         npmci npm install | ||||
|         pnpm install -g @gitzone/tsdoc | ||||
|         npmci command tsdoc | ||||
|       continue-on-error: true | ||||
							
								
								
									
										128
									
								
								.gitlab-ci.yml
									
									
									
									
									
								
							
							
						
						
									
										128
									
								
								.gitlab-ci.yml
									
									
									
									
									
								
							| @@ -1,128 +0,0 @@ | ||||
| # gitzone ci_default | ||||
| image: registry.gitlab.com/hosttoday/ht-docker-node:npmci | ||||
|  | ||||
| cache: | ||||
|   paths: | ||||
|     - .npmci_cache/ | ||||
|   key: '$CI_BUILD_STAGE' | ||||
|  | ||||
| stages: | ||||
|   - security | ||||
|   - test | ||||
|   - release | ||||
|   - metadata | ||||
|  | ||||
| before_script: | ||||
|   - pnpm install -g pnpm | ||||
|   - pnpm install -g @shipzone/npmci | ||||
|   - npmci npm prepare | ||||
|  | ||||
| # ==================== | ||||
| # security stage | ||||
| # ==================== | ||||
| # ==================== | ||||
| # security stage | ||||
| # ==================== | ||||
| auditProductionDependencies: | ||||
|   image: registry.gitlab.com/hosttoday/ht-docker-node:npmci | ||||
|   stage: security | ||||
|   script: | ||||
|      - npmci command npm config set registry https://registry.npmjs.org | ||||
|      - npmci command pnpm audit --audit-level=high --prod | ||||
|   tags: | ||||
|     - lossless | ||||
|     - docker | ||||
|   allow_failure: true | ||||
|  | ||||
| auditDevDependencies: | ||||
|   image: registry.gitlab.com/hosttoday/ht-docker-node:npmci | ||||
|   stage: security | ||||
|   script: | ||||
|     - npmci command npm config set registry https://registry.npmjs.org | ||||
|     - npmci command pnpm audit --audit-level=high --dev | ||||
|   tags: | ||||
|     - lossless | ||||
|     - docker | ||||
|   allow_failure: true | ||||
|  | ||||
| # ==================== | ||||
| # test stage | ||||
| # ==================== | ||||
|  | ||||
| testStable: | ||||
|   stage: test | ||||
|   script: | ||||
|     - npmci node install stable | ||||
|     - npmci npm install | ||||
|     - npmci npm test | ||||
|   coverage: /\d+.?\d+?\%\s*coverage/ | ||||
|   tags: | ||||
|     - docker | ||||
|  | ||||
| testBuild: | ||||
|   stage: test | ||||
|   script: | ||||
|     - npmci node install stable | ||||
|     - npmci npm install | ||||
|     - npmci command npm run build | ||||
|   coverage: /\d+.?\d+?\%\s*coverage/ | ||||
|   tags: | ||||
|     - docker | ||||
|  | ||||
| release: | ||||
|   stage: release | ||||
|   script: | ||||
|     - npmci node install stable | ||||
|     - npmci npm publish | ||||
|   only: | ||||
|     - tags | ||||
|   tags: | ||||
|     - lossless | ||||
|     - docker | ||||
|     - notpriv | ||||
|  | ||||
| # ==================== | ||||
| # metadata stage | ||||
| # ==================== | ||||
| codequality: | ||||
|   stage: metadata | ||||
|   allow_failure: true | ||||
|   only: | ||||
|     - tags | ||||
|   script: | ||||
|     - npmci command npm install -g typescript | ||||
|     - npmci npm prepare | ||||
|     - npmci npm install | ||||
|   tags: | ||||
|     - lossless | ||||
|     - docker | ||||
|     - priv | ||||
|  | ||||
| trigger: | ||||
|   stage: metadata | ||||
|   script: | ||||
|     - npmci trigger | ||||
|   only: | ||||
|     - tags | ||||
|   tags: | ||||
|     - lossless | ||||
|     - docker | ||||
|     - notpriv | ||||
|  | ||||
| pages: | ||||
|   stage: metadata | ||||
|   script: | ||||
|     - npmci node install stable | ||||
|     - npmci npm install | ||||
|     - npmci command npm run buildDocs | ||||
|   tags: | ||||
|     - lossless | ||||
|     - docker | ||||
|     - notpriv | ||||
|   only: | ||||
|     - tags | ||||
|   artifacts: | ||||
|     expire_in: 1 week | ||||
|     paths: | ||||
|       - public | ||||
|   allow_failure: true | ||||
| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "@shipzone/npmci", | ||||
|   "version": "4.1.0", | ||||
|   "version": "4.1.7", | ||||
|   "private": false, | ||||
|   "description": "node and docker in gitlab ci on steroids", | ||||
|   "main": "dist_ts/index.js", | ||||
|   | ||||
							
								
								
									
										1466
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1466
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -21,7 +21,6 @@ Code Style | [](htt | ||||
| PackagePhobia (total standalone install weight) | [](https://lossless.cloud) | ||||
| PackagePhobia (package size on registry) | [](https://lossless.cloud) | ||||
| BundlePhobia (total size when bundled) | [](https://lossless.cloud) | ||||
| Platform support | [](https://lossless.cloud) [](https://lossless.cloud) | ||||
|  | ||||
| ## Usage | ||||
|  | ||||
| @@ -106,7 +105,6 @@ We are always happy for code contributions. If you are not the code contributing | ||||
|  | ||||
| For further information read the linked docs at the top of this readme. | ||||
|  | ||||
| > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) | ||||
| ## Legal | ||||
| > MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc) | ||||
| | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) | ||||
|  | ||||
| [](https://maintainedby.lossless.com) | ||||
|   | ||||
| @@ -3,6 +3,6 @@ | ||||
|  */ | ||||
| export const commitinfo = { | ||||
|   name: '@shipzone/npmci', | ||||
|   version: '4.1.0', | ||||
|   version: '4.1.7', | ||||
|   description: 'node and docker in gitlab ci on steroids' | ||||
| } | ||||
|   | ||||
| @@ -77,7 +77,7 @@ export class NpmciDockerManager { | ||||
|    */ | ||||
|   public prepare = async () => { | ||||
|     // Always login to GitLab Registry | ||||
|     if (!process.env.CI_BUILD_TOKEN || process.env.CI_BUILD_TOKEN === '') { | ||||
|     if (!process.env.CI_JOB_TOKEN || process.env.CI_JOB_TOKEN === '') { | ||||
|       logger.log('error', 'No registry token specified by gitlab!'); | ||||
|       process.exit(1); | ||||
|     } | ||||
| @@ -85,7 +85,7 @@ export class NpmciDockerManager { | ||||
|       new DockerRegistry({ | ||||
|         registryUrl: 'registry.gitlab.com', | ||||
|         username: 'gitlab-ci-token', | ||||
|         password: process.env.CI_BUILD_TOKEN, | ||||
|         password: process.env.CI_JOB_TOKEN, | ||||
|       }) | ||||
|     ); | ||||
|  | ||||
|   | ||||
| @@ -177,14 +177,17 @@ export class Dockerfile { | ||||
|   ): Promise<string> { | ||||
|     logger.log('info', 'checking for env vars to be supplied to the docker build'); | ||||
|     let buildArgsString: string = ''; | ||||
|     for (const key of Object.keys( | ||||
|     for (const dockerArgKey of Object.keys( | ||||
|       npmciDockerManagerRef.npmciRef.npmciConfig.getConfig().dockerBuildargEnvMap | ||||
|     )) { | ||||
|       const targetValue = | ||||
|         process.env[ | ||||
|           npmciDockerManagerRef.npmciRef.npmciConfig.getConfig().dockerBuildargEnvMap[key] | ||||
|         ]; | ||||
|       buildArgsString = `${buildArgsString} --build-arg ${key}="${targetValue}"`; | ||||
|       const dockerArgOuterEnvVar = | ||||
|         npmciDockerManagerRef.npmciRef.npmciConfig.getConfig().dockerBuildargEnvMap[dockerArgKey]; | ||||
|       logger.log( | ||||
|         'note', | ||||
|         `docker ARG "${dockerArgKey}" maps to outer env var "${dockerArgOuterEnvVar}"` | ||||
|       ); | ||||
|       const targetValue = process.env[dockerArgOuterEnvVar]; | ||||
|       buildArgsString = `${buildArgsString} --build-arg ${dockerArgKey}="${targetValue}"`; | ||||
|     } | ||||
|     return buildArgsString; | ||||
|   } | ||||
|   | ||||
| @@ -59,6 +59,7 @@ export class NpmciNpmManager { | ||||
|       'NPMCI_TOKEN_NPM*', | ||||
|       (npmEnvArg: string) => { | ||||
|         const npmRegistryUrl = npmEnvArg.split('|')[0]; | ||||
|         logger.log('ok', `found token for ${npmRegistryUrl}`); | ||||
|         let npmToken = npmEnvArg.split('|')[1]; | ||||
|         if (npmEnvArg.split('|')[2] && npmEnvArg.split('|')[2] === 'plain') { | ||||
|           logger.log('ok', 'npm token not base64 encoded.'); | ||||
|   | ||||
| @@ -82,15 +82,13 @@ export class NpmciCli { | ||||
|     this.smartcli.addCommand('precheck').subscribe(async (argvArg) => { | ||||
|       const modPrecheck = await import('./mod_precheck/index.js'); | ||||
|       await modPrecheck.handleCli(this.npmciRef, argvArg); | ||||
|     }) | ||||
|     }); | ||||
|  | ||||
|     // trigger | ||||
|     this.smartcli.addCommand('ssh').subscribe( | ||||
|       async (argvArg) => { | ||||
|     this.smartcli.addCommand('ssh').subscribe(async (argvArg) => { | ||||
|       const modSsh = await import('./mod_ssh/index.js'); | ||||
|       await modSsh.handleCli(argvArg); | ||||
|       } | ||||
|     ); | ||||
|     }); | ||||
|  | ||||
|     // trigger | ||||
|     this.smartcli.addCommand('trigger').subscribe( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user