Compare commits
	
		
			24 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 4c07131e51 | |||
| ba039469ff | |||
| 49f2498ecd | |||
| 1060060366 | |||
| 0fa3a579f7 | |||
| 0e4556d59e | |||
| e2e7967fba | |||
| 45b8d67abf | |||
| 0a69aa5d62 | |||
| dfbab1a1df | |||
| e58f009a24 | |||
| 2afd9cddc5 | |||
| d79c5366ef | |||
| 8e4f7ad244 | |||
| 39de3a1601 | |||
| cb3d2964d1 | |||
| 6b5390cef8 | |||
| 2736b85de3 | |||
| 82d7778f59 | |||
| 8c99cc0491 | |||
| 955e3d0dbe | |||
| 702ae8bed8 | |||
| b6f0723b75 | |||
| 8a2fb30e59 | 
| @@ -7,10 +7,10 @@ on: | ||||
|  | ||||
| env: | ||||
|   IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci | ||||
|   NPMCI_TOKEN_NPM: $ | ||||
|   NPMCI_TOKEN_NPM2: $ | ||||
|   NPMCI_GIT_GITHUBTOKEN: $ | ||||
|   NPMCI_URL_CLOUDLY: $ | ||||
|   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: | ||||
|  | ||||
|   | ||||
| @@ -7,10 +7,9 @@ on: | ||||
|  | ||||
| env: | ||||
|   IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci | ||||
|   NPMCI_TOKEN_NPM: $ | ||||
|   NPMCI_TOKEN_NPM2: $ | ||||
|   NPMCI_GIT_GITHUBTOKEN: $ | ||||
|   NPMCI_URL_CLOUDLY: $ | ||||
|   NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}} | ||||
|   NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}} | ||||
|   NPMCI_LOGIN_DOCKER_GITEA: ${{secrets.NPMCI_DOCKER_REGISTRYURL_DEFAULT}}|${{ gitea.repository_owner }}|${{ secrets.GITEA_TOKEN }} | ||||
|  | ||||
| jobs: | ||||
|  | ||||
|   | ||||
| @@ -1,107 +0,0 @@ | ||||
| name: CI Pipeline | ||||
|  | ||||
| on: push | ||||
|  | ||||
| env: | ||||
|   IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci | ||||
|  | ||||
| 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 | ||||
|         npmci command npm run buildDocs | ||||
|  | ||||
|     - name: Upload artifacts | ||||
|       uses: actions/upload-artifact@v2 | ||||
|       with: | ||||
|         name: public | ||||
|         path: public | ||||
|         retention-days: 7 | ||||
							
								
								
									
										40
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								package.json
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "@shipzone/npmci", | ||||
|   "version": "4.1.5", | ||||
|   "version": "4.1.17", | ||||
|   "private": false, | ||||
|   "description": "node and docker in gitlab ci on steroids", | ||||
|   "main": "dist_ts/index.js", | ||||
| @@ -26,37 +26,37 @@ | ||||
|   }, | ||||
|   "homepage": "https://gitlab.com/gitzone/npmci#README", | ||||
|   "devDependencies": { | ||||
|     "@gitzone/tsbuild": "^2.1.65", | ||||
|     "@gitzone/tsrun": "^1.2.37", | ||||
|     "@gitzone/tstest": "^1.0.73", | ||||
|     "@pushrocks/tapbundle": "^5.0.4", | ||||
|     "@types/node": "^18.8.3" | ||||
|     "@gitzone/tsbuild": "^2.1.66", | ||||
|     "@gitzone/tsrun": "^1.2.42", | ||||
|     "@gitzone/tstest": "^1.0.74", | ||||
|     "@pushrocks/tapbundle": "^5.0.8", | ||||
|     "@types/node": "^20.3.1" | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "@apiglobal/typedrequest": "^2.0.10", | ||||
|     "@pushrocks/lik": "^6.0.0", | ||||
|     "@apiglobal/typedrequest": "^2.0.12", | ||||
|     "@pushrocks/lik": "^6.0.2", | ||||
|     "@pushrocks/npmextra": "^3.0.9", | ||||
|     "@pushrocks/projectinfo": "^5.0.1", | ||||
|     "@pushrocks/qenv": "^5.0.2", | ||||
|     "@pushrocks/smartanalytics": "^2.0.15", | ||||
|     "@pushrocks/smartcli": "^4.0.6", | ||||
|     "@pushrocks/smartdelay": "^2.0.13", | ||||
|     "@pushrocks/smartenv": "^5.0.3", | ||||
|     "@pushrocks/smartfile": "^10.0.5", | ||||
|     "@pushrocks/smartdelay": "^3.0.1", | ||||
|     "@pushrocks/smartenv": "^5.0.5", | ||||
|     "@pushrocks/smartfile": "^10.0.25", | ||||
|     "@pushrocks/smartgit": "^3.0.0", | ||||
|     "@pushrocks/smartlog": "^3.0.1", | ||||
|     "@pushrocks/smartlog-destination-local": "^8.0.8", | ||||
|     "@pushrocks/smartlog": "^3.0.2", | ||||
|     "@pushrocks/smartlog-destination-local": "^9.0.0", | ||||
|     "@pushrocks/smartparam": "^1.1.6", | ||||
|     "@pushrocks/smartpath": "^5.0.5", | ||||
|     "@pushrocks/smartpromise": "^3.1.7", | ||||
|     "@pushrocks/smartrequest": "^2.0.11", | ||||
|     "@pushrocks/smartshell": "^2.0.30", | ||||
|     "@pushrocks/smartsocket": "^2.0.7", | ||||
|     "@pushrocks/smartpromise": "^4.0.2", | ||||
|     "@pushrocks/smartrequest": "^2.0.15", | ||||
|     "@pushrocks/smartshell": "^3.0.3", | ||||
|     "@pushrocks/smartsocket": "^2.0.19", | ||||
|     "@pushrocks/smartssh": "^2.0.0", | ||||
|     "@pushrocks/smartstring": "^4.0.5", | ||||
|     "@pushrocks/smartstring": "^4.0.7", | ||||
|     "@servezone/interfaces": "^1.0.3", | ||||
|     "@tsclass/tsclass": "^4.0.21", | ||||
|     "@types/through2": "^2.0.36", | ||||
|     "@tsclass/tsclass": "^4.0.42", | ||||
|     "@types/through2": "^2.0.38", | ||||
|     "through2": "^4.0.2" | ||||
|   }, | ||||
|   "files": [ | ||||
|   | ||||
							
								
								
									
										2243
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2243
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -21,6 +21,8 @@ process.cwd = () => { | ||||
|  | ||||
| let npmci: typeof import('../ts/index.js'); | ||||
|  | ||||
| type TNpmciTypes = typeof import('../ts/index.js'); | ||||
|  | ||||
| tap.preTask('should import npmci', async () => { | ||||
|   npmci = await import('../ts/index.js'); | ||||
| }); | ||||
|   | ||||
| @@ -3,6 +3,6 @@ | ||||
|  */ | ||||
| export const commitinfo = { | ||||
|   name: '@shipzone/npmci', | ||||
|   version: '4.1.5', | ||||
|   version: '4.1.17', | ||||
|   description: 'node and docker in gitlab ci on steroids' | ||||
| } | ||||
|   | ||||
| @@ -77,8 +77,10 @@ export class NpmciDockerManager { | ||||
|    */ | ||||
|   public prepare = async () => { | ||||
|     // Always login to GitLab Registry | ||||
|     if (process.env.GITLAB_CI) { | ||||
|       console.log('gitlab ci detected'); | ||||
|       if (!process.env.CI_JOB_TOKEN || process.env.CI_JOB_TOKEN === '') { | ||||
|       logger.log('error', 'No registry token specified by gitlab!'); | ||||
|         logger.log('error', 'Running in Gitlab CI, but no registry token specified by gitlab!'); | ||||
|         process.exit(1); | ||||
|       } | ||||
|       this.npmciRegistryStorage.addRegistry( | ||||
| @@ -88,6 +90,7 @@ export class NpmciDockerManager { | ||||
|           password: process.env.CI_JOB_TOKEN, | ||||
|         }) | ||||
|       ); | ||||
|     } | ||||
|  | ||||
|     // handle registries | ||||
|     await plugins.smartparam.forEachMinimatch( | ||||
|   | ||||
| @@ -120,15 +120,19 @@ export class Dockerfile { | ||||
|    * returns a version for a docker file | ||||
|    * @execution SYNC | ||||
|    */ | ||||
|   public static dockerFileVersion(dockerfileNameArg: string): string { | ||||
|   public static dockerFileVersion(dockerfileInstanceArg: Dockerfile, dockerfileNameArg: string): string { | ||||
|     let versionString: string; | ||||
|     const versionRegex = /Dockerfile_([a-zA-Z0-9\.]*)$/; | ||||
|     const versionRegex = /Dockerfile_([^:_]*)$/; | ||||
|     const regexResultArray = versionRegex.exec(dockerfileNameArg); | ||||
|     if (regexResultArray && regexResultArray.length === 2) { | ||||
|       versionString = regexResultArray[1]; | ||||
|     } else { | ||||
|       versionString = 'latest'; | ||||
|     } | ||||
|     versionString = versionString.replace( | ||||
|       '##version##', | ||||
|       dockerfileInstanceArg.npmciDockerManagerRef.npmciRef.npmciConfig.getConfig().projectInfo.npm.version | ||||
|     ); | ||||
|     return versionString; | ||||
|   } | ||||
|  | ||||
| @@ -233,7 +237,7 @@ export class Dockerfile { | ||||
|       this.npmciDockerManagerRef.npmciRef.npmciEnv.repo.user + | ||||
|       '/' + | ||||
|       this.npmciDockerManagerRef.npmciRef.npmciEnv.repo.repo; | ||||
|     this.version = Dockerfile.dockerFileVersion(plugins.path.parse(options.filePath).base); | ||||
|     this.version = Dockerfile.dockerFileVersion(this, plugins.path.parse(options.filePath).base); | ||||
|     this.cleanTag = this.repo + ':' + this.version; | ||||
|     this.buildTag = this.cleanTag; | ||||
|  | ||||
|   | ||||
| @@ -26,7 +26,7 @@ export class DockerRegistry { | ||||
|       process.exit(1); | ||||
|       return; | ||||
|     } | ||||
|     const registryUrl = dockerRegexResultArray[0]; | ||||
|     const registryUrl = dockerRegexResultArray[0].replace('https://', '').replace('http://', ''); | ||||
|     const username = dockerRegexResultArray[1]; | ||||
|     const password = dockerRegexResultArray[2]; | ||||
|     return new DockerRegistry({ | ||||
|   | ||||
| @@ -9,7 +9,12 @@ export class NpmciEnv { | ||||
|  | ||||
|   constructor(npmciRefArg: Npmci) { | ||||
|     this.npmciRef = npmciRefArg; | ||||
|     if (process.env.GITLAB_CI) { | ||||
|       this.repoString = process.env.CI_REPOSITORY_URL; | ||||
|     } | ||||
|     if (process.env.NPMCI_COMPUTED_REPOURL) { | ||||
|       this.repoString = process.env.NPMCI_COMPUTED_REPOURL; | ||||
|     } | ||||
|     if (!this.repoString) { | ||||
|       this.repoString = 'https://undefined:undefined@github.com/undefined/undefined.git'; | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user