Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e848e5e0
Commit
e848e5e0
authored
Jan 27, 2022
by
Sofia Vistas
Committed by
Dan Davison
Jan 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor to use fixtures folder instead of CI scripts
parent
1a8b8581
Changes
40
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
631 additions
and
672 deletions
+631
-672
qa/qa/fixtures/package_managers/composer/composer.json.erb
qa/qa/fixtures/package_managers/composer/composer.json.erb
+13
-0
qa/qa/fixtures/package_managers/composer/composer_upload_package.yaml.erb
...ackage_managers/composer/composer_upload_package.yaml.erb
+13
-0
qa/qa/fixtures/package_managers/conan/conan_upload_install_package.yaml.erb
...kage_managers/conan/conan_upload_install_package.yaml.erb
+12
-0
qa/qa/fixtures/package_managers/generic/generic_upload_install_package.yaml.erb
..._managers/generic/generic_upload_install_package.yaml.erb
+18
-0
qa/qa/fixtures/package_managers/helm/Chart.yaml.erb
qa/qa/fixtures/package_managers/helm/Chart.yaml.erb
+6
-0
qa/qa/fixtures/package_managers/helm/helm_install_package.yaml.erb
...tures/package_managers/helm/helm_install_package.yaml.erb
+11
-0
qa/qa/fixtures/package_managers/helm/helm_upload_package.yaml.erb
...xtures/package_managers/helm/helm_upload_package.yaml.erb
+14
-0
qa/qa/fixtures/package_managers/maven/build_install.gradle.erb
.../fixtures/package_managers/maven/build_install.gradle.erb
+28
-0
qa/qa/fixtures/package_managers/maven/build_upload.gradle.erb
...a/fixtures/package_managers/maven/build_upload.gradle.erb
+27
-0
qa/qa/fixtures/package_managers/maven/client_pom.xml.erb
qa/qa/fixtures/package_managers/maven/client_pom.xml.erb
+19
-0
qa/qa/fixtures/package_managers/maven/gradle_install_package.yaml.erb
...es/package_managers/maven/gradle_install_package.yaml.erb
+8
-0
qa/qa/fixtures/package_managers/maven/gradle_upload_package.yaml.erb
...res/package_managers/maven/gradle_upload_package.yaml.erb
+8
-0
qa/qa/fixtures/package_managers/maven/maven_install_package.yaml.erb
...res/package_managers/maven/maven_install_package.yaml.erb
+8
-0
qa/qa/fixtures/package_managers/maven/maven_upload_package.yaml.erb
...ures/package_managers/maven/maven_upload_package.yaml.erb
+8
-0
qa/qa/fixtures/package_managers/maven/package_pom.xml.erb
qa/qa/fixtures/package_managers/maven/package_pom.xml.erb
+22
-0
qa/qa/fixtures/package_managers/maven/settings.xml.erb
qa/qa/fixtures/package_managers/maven/settings.xml.erb
+16
-0
qa/qa/fixtures/package_managers/maven/settings_with_pat.xml.erb
...fixtures/package_managers/maven/settings_with_pat.xml.erb
+16
-0
qa/qa/fixtures/package_managers/npm/npm_install_package_instance.yaml.erb
...ackage_managers/npm/npm_install_package_instance.yaml.erb
+21
-0
qa/qa/fixtures/package_managers/npm/npm_upload_install_package_project.yaml.erb
..._managers/npm/npm_upload_install_package_project.yaml.erb
+31
-0
qa/qa/fixtures/package_managers/npm/npm_upload_package_instance.yaml.erb
...package_managers/npm/npm_upload_package_instance.yaml.erb
+14
-0
qa/qa/fixtures/package_managers/npm/package_instance.json.erb
...a/fixtures/package_managers/npm/package_instance.json.erb
+8
-0
qa/qa/fixtures/package_managers/npm/package_project.json.erb
qa/qa/fixtures/package_managers/npm/package_project.json.erb
+8
-0
qa/qa/fixtures/package_managers/nuget/nuget_install_package.yaml.erb
...res/package_managers/nuget/nuget_install_package.yaml.erb
+15
-0
qa/qa/fixtures/package_managers/nuget/nuget_upload_package.yaml.erb
...ures/package_managers/nuget/nuget_upload_package.yaml.erb
+17
-0
qa/qa/fixtures/package_managers/pypi/pypi_upload_install_package.yaml.erb
...ackage_managers/pypi/pypi_upload_install_package.yaml.erb
+19
-0
qa/qa/fixtures/package_managers/pypi/setup.py.erb
qa/qa/fixtures/package_managers/pypi/setup.py.erb
+16
-0
qa/qa/fixtures/package_managers/rubygems/package.gemspec.erb
qa/qa/fixtures/package_managers/rubygems/package.gemspec.erb
+39
-0
qa/qa/fixtures/package_managers/rubygems/rubygems_upload_package.yaml.erb
...ackage_managers/rubygems/rubygems_upload_package.yaml.erb
+15
-0
qa/qa/runtime/fixtures.rb
qa/qa/runtime/fixtures.rb
+8
-0
qa/qa/specs/features/browser_ui/5_package/package_registry/composer_registry_spec.rb
...r_ui/5_package/package_registry/composer_registry_spec.rb
+6
-39
qa/qa/specs/features/browser_ui/5_package/package_registry/conan_repository_spec.rb
...er_ui/5_package/package_registry/conan_repository_spec.rb
+3
-15
qa/qa/specs/features/browser_ui/5_package/package_registry/generic_repository_spec.rb
..._ui/5_package/package_registry/generic_repository_spec.rb
+6
-25
qa/qa/specs/features/browser_ui/5_package/package_registry/helm_registry_spec.rb
...owser_ui/5_package/package_registry/helm_registry_spec.rb
+21
-60
qa/qa/specs/features/browser_ui/5_package/package_registry/maven_gradle_repository_spec.rb
..._package/package_registry/maven_gradle_repository_spec.rb
+27
-110
qa/qa/specs/features/browser_ui/5_package/package_registry/maven_repository_spec.rb
...er_ui/5_package/package_registry/maven_repository_spec.rb
+63
-151
qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_instance_level_spec.rb
...5_package/package_registry/npm/npm_instance_level_spec.rb
+18
-73
qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_project_level_spec.rb
.../5_package/package_registry/npm/npm_project_level_spec.rb
+11
-58
qa/qa/specs/features/browser_ui/5_package/package_registry/nuget_repository_spec.rb
...er_ui/5_package/package_registry/nuget_repository_spec.rb
+6
-36
qa/qa/specs/features/browser_ui/5_package/package_registry/pypi_repository_spec.rb
...ser_ui/5_package/package_registry/pypi_repository_spec.rb
+7
-44
qa/qa/specs/features/browser_ui/5_package/package_registry/rubygems_registry_spec.rb
...r_ui/5_package/package_registry/rubygems_registry_spec.rb
+5
-61
No files found.
qa/qa/fixtures/package_managers/composer/composer.json.erb
0 → 100644
View file @
e848e5e0
{
"name": "
<%=
project
.
path_with_namespace
%>
/
<%=
package
.
name
%>
",
"description": "Library XY",
"type": "library",
"license": "GPL-3.0-only",
"authors": [
{
"name": "John Doe",
"email": "john@example.com"
}
],
"require": {}
}
\ No newline at end of file
qa/qa/fixtures/package_managers/composer/composer_upload_package.yaml.erb
0 → 100644
View file @
e848e5e0
publish:
image: curlimages/curl:latest
stage: build
variables:
URL: "$CI_SERVER_PROTOCOL://$CI_SERVER_HOST:$CI_SERVER_PORT/api/v4/projects/$CI_PROJECT_ID/packages/composer?job_token=$CI_JOB_TOKEN"
script:
- version=$([[ -z "$CI_COMMIT_TAG" ]]
&&
echo "branch=$CI_COMMIT_REF_NAME" || echo "tag=$CI_COMMIT_TAG")
- insecure=$([ "$CI_SERVER_PROTOCOL" = "http" ]
&&
echo "--insecure" || echo "")
- response=$(curl -s -w "%{http_code}" $insecure --data $version $URL)
- code=$(echo "$response" | tail -n 1)
- body=$(echo "$response" | head -n 1)
tags:
- "runner-for-
<%=
project
.
name
%>
"
\ No newline at end of file
qa/qa/fixtures/package_managers/conan/conan_upload_install_package.yaml.erb
0 → 100644
View file @
e848e5e0
image: conanio/gcc7
test_package:
stage: deploy
script:
- conan remote add gitlab
<%=
gitlab_address_with_port
%>
/api/v4/projects/
<%=
project
.
id
%>
/packages/conan
- conan new
<%=
package
.
name
%>
/0.1 -t
- conan create . mycompany/stable
- "CONAN_LOGIN_USERNAME=ci_user CONAN_PASSWORD=${CI_JOB_TOKEN} conan upload
<%=
package
.
name
%>
/0.1@mycompany/stable --all --remote=gitlab"
- conan install
<%=
package
.
name
%>
/0.1@mycompany/stable --remote=gitlab
tags:
- runner-for-
<%=
project
.
name
%>
\ No newline at end of file
qa/qa/fixtures/package_managers/generic/generic_upload_install_package.yaml.erb
0 → 100644
View file @
e848e5e0
image: curlimages/curl:latest
stages:
- upload
- download
upload:
stage: upload
script:
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file file.txt ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/
<%=
package
.
name
%>
/0.0.1/file.txt'
tags:
- runner-for-
<%=
project
.
name
%>
download:
stage: download
script:
- 'wget --header="JOB-TOKEN: $CI_JOB_TOKEN" ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/
<%=
package
.
name
%>
/0.0.1/file.txt -O file_downloaded.txt'
tags:
- runner-for-
<%=
project
.
name
%>
\ No newline at end of file
qa/qa/fixtures/package_managers/helm/Chart.yaml.erb
0 → 100644
View file @
e848e5e0
apiVersion: v2
name:
<%=
package_name
%>
description: GitLab QA helm package
type: application
version:
<%=
package_version
%>
appVersion: "1.16.0"
\ No newline at end of file
qa/qa/fixtures/package_managers/helm/helm_install_package.yaml.erb
0 → 100644
View file @
e848e5e0
pull:
image: alpine:3
script:
- apk add helm --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
- helm repo add --username
<%=
username
%>
--password
<%=
access_token
%>
gitlab_qa ${CI_API_V4_URL}/projects/
<%=
package_project
.
id
%>
/packages/helm/stable
- helm repo update
- helm pull gitlab_qa/
<%=
package_name
%>
only:
-
<%=
client_project
.
default_branch
%>
tags:
- runner-for-
<%=
client_project
.
group
.
name
%>
\ No newline at end of file
qa/qa/fixtures/package_managers/helm/helm_upload_package.yaml.erb
0 → 100644
View file @
e848e5e0
deploy:
image: alpine:3
script:
- apk add helm --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
- apk add curl
- helm create
<%=
package_name
%>
- cp ./Chart.yaml
<%=
package_name
%>
- helm package
<%=
package_name
%>
- http_code=$(curl --write-out "%{http_code}" --request POST --form 'chart=@
<%=
package_name
%>
-
<%=
package_version
%>
.tgz' --user
<%=
username
%>
:
<%=
access_token
%>
${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/stable/charts --output /dev/null --silent)
- '[ $http_code = "201" ]'
only:
-
<%=
package_project
.
default_branch
%>
tags:
- runner-for-
<%=
package_project
.
group
.
name
%>
\ No newline at end of file
qa/qa/fixtures/package_managers/maven/build_install.gradle.erb
0 → 100644
View file @
e848e5e0
plugins {
id 'java'
id 'application'
}
repositories {
jcenter()
maven {
url "
<%=
gitlab_address_with_port
%>
/api/v4/projects/
<%=
package_project
.
id
%>
/packages/maven"
name "GitLab"
credentials(HttpHeaderCredentials) {
name = '
<%=
maven_header_name
%>
'
value =
<%=
token
%>
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
dependencies {
implementation group: '
<%=
group_id
%>
', name: '
<%=
artifact_id
%>
', version: '
<%=
package_version
%>
'
testImplementation 'junit:junit:4.12'
}
application {
mainClassName = 'gradle_maven_app.App'
}
\ No newline at end of file
qa/qa/fixtures/package_managers/maven/build_upload.gradle.erb
0 → 100644
View file @
e848e5e0
plugins {
id 'java'
id 'maven-publish'
}
publishing {
publications {
library(MavenPublication) {
groupId '
<%=
group_id
%>
'
artifactId '
<%=
artifact_id
%>
'
version '
<%=
package_version
%>
'
from components.java
}
}
repositories {
maven {
url "
<%=
gitlab_address_with_port
%>
/api/v4/projects/
<%=
package_project
.
id
%>
/packages/maven"
credentials(HttpHeaderCredentials) {
name = "Private-Token"
value = "
<%=
personal_access_token
%>
"
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}
\ No newline at end of file
qa/qa/fixtures/package_managers/maven/client_pom.xml.erb
0 → 100644
View file @
e848e5e0
<project>
<groupId>
<%=
group_id
%>
</groupId>
<artifactId>
maven_client
</artifactId>
<version>
1.0
</version>
<modelVersion>
4.0.0
</modelVersion>
<repositories>
<repository>
<id>
<%=
package_project
.
name
%>
</id>
<url>
<%=
gitlab_address_with_port
%>
/api/v4/groups/
<%=
package_project
.
group
.
id
%>
/-/packages/maven
</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>
<%=
group_id
%>
</groupId>
<artifactId>
<%=
artifact_id
%>
</artifactId>
<version>
<%=
package_version
%>
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
qa/qa/fixtures/package_managers/maven/gradle_install_package.yaml.erb
0 → 100644
View file @
e848e5e0
build:
image: gradle:6.5-jdk11
script:
- 'gradle build'
only:
- "
<%=
client_project
.
default_branch
%>
"
tags:
- "runner-for-
<%=
client_project
.
group
.
name
%>
"
\ No newline at end of file
qa/qa/fixtures/package_managers/maven/gradle_upload_package.yaml.erb
0 → 100644
View file @
e848e5e0
deploy:
image: gradle:6.5-jdk11
script:
- 'gradle publish'
only:
- "
<%=
package_project
.
default_branch
%>
"
tags:
- "runner-for-
<%=
package_project
.
group
.
name
%>
"
\ No newline at end of file
qa/qa/fixtures/package_managers/maven/maven_install_package.yaml.erb
0 → 100644
View file @
e848e5e0
install:
image: maven:3.6-jdk-11
script:
- "mvn install -s settings.xml"
only:
- "
<%=
client_project
.
default_branch
%>
"
tags:
- "runner-for-
<%=
client_project
.
group
.
name
%>
"
\ No newline at end of file
qa/qa/fixtures/package_managers/maven/maven_upload_package.yaml.erb
0 → 100644
View file @
e848e5e0
deploy:
image: maven:3.6-jdk-11
script:
- 'mvn deploy -s settings.xml'
only:
- "
<%=
package_project
.
default_branch
%>
"
tags:
- "runner-for-
<%=
package_project
.
group
.
name
%>
"
\ No newline at end of file
qa/qa/fixtures/package_managers/maven/package_pom.xml.erb
0 → 100644
View file @
e848e5e0
<project>
<groupId>
<%=
group_id
%>
</groupId>
<artifactId>
<%=
artifact_id
%>
</artifactId>
<version>
<%=
package_version
%>
</version>
<modelVersion>
4.0.0
</modelVersion>
<repositories>
<repository>
<id>
<%=
package_project
.
name
%>
</id>
<url>
<%=
gitlab_address_with_port
%>
/api/v4/groups/
<%=
package_project
.
group
.
id
%>
/-/packages/maven
</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>
<%=
package_project
.
name
%>
</id>
<url>
<%=
gitlab_address_with_port
%>
/api/v4/projects/
<%=
package_project
.
id
%>
/packages/maven
</url>
</repository>
<snapshotRepository>
<id>
<%=
package_project
.
name
%>
</id>
<url>
<%=
gitlab_address_with_port
%>
/api/v4/projects/
<%=
package_project
.
id
%>
/packages/maven
</url>
</snapshotRepository>
</distributionManagement>
</project>
\ No newline at end of file
qa/qa/fixtures/package_managers/maven/settings.xml.erb
0 → 100644
View file @
e848e5e0
<settings
xmlns=
"http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"
>
<servers>
<server>
<id>
<%=
package_project
.
name
%>
</id>
<configuration>
<httpHeaders>
<property>
<name>
<%=
maven_header_name
%>
</name>
<value>
<%=
token
%>
</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>
\ No newline at end of file
qa/qa/fixtures/package_managers/maven/settings_with_pat.xml.erb
0 → 100644
View file @
e848e5e0
<settings
xmlns=
"http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"
>
<servers>
<server>
<id>
<%=
package_project
.
name
%>
</id>
<configuration>
<httpHeaders>
<property>
<name>
Private-Token
</name>
<value>
<%=
personal_access_token
%>
</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>
\ No newline at end of file
qa/qa/fixtures/package_managers/npm/npm_install_package_instance.yaml.erb
0 → 100644
View file @
e848e5e0
image: node:latest
stages:
- install
install:
stage: install
script:
- "npm config set @
<%=
registry_scope
%>
:registry
<%=
gitlab_address_with_port
%>
/api/v4/packages/npm/"
- "npm install
<%=
package
.
name
%>
"
cache:
key: ${CI_BUILD_REF_NAME}
paths:
- node_modules/
artifacts:
paths:
- node_modules/
only:
- "
<%=
another_project
.
default_branch
%>
"
tags:
- "runner-for-
<%=
another_project
.
group
.
name
%>
"
\ No newline at end of file
qa/qa/fixtures/package_managers/npm/npm_upload_install_package_project.yaml.erb
0 → 100644
View file @
e848e5e0
image: node:latest
stages:
- deploy
- install
deploy:
stage: deploy
script:
- echo "//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=
<%=
auth_token
%>
">.npmrc
- npm publish
only:
- "
<%=
project
.
default_branch
%>
"
tags:
- "runner-for-
<%=
project
.
name
%>
"
install:
stage: install
script:
- "npm config set @
<%=
registry_scope
%>
:registry
<%=
gitlab_address_with_port
%>
/api/v4/projects/${CI_PROJECT_ID}/packages/npm/"
- "npm install
<%=
package
.
name
%>
"
cache:
key: ${CI_BUILD_REF_NAME}
paths:
- node_modules/
artifacts:
paths:
- node_modules/
only:
- "
<%=
project
.
default_branch
%>
"
tags:
- "runner-for-
<%=
project
.
name
%>
"
\ No newline at end of file
qa/qa/fixtures/package_managers/npm/npm_upload_package_instance.yaml.erb
0 → 100644
View file @
e848e5e0
image: node:latest
stages:
- deploy
deploy:
stage: deploy
script:
- echo "//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=
<%=
auth_token
%>
">.npmrc
- npm publish
only:
- "
<%=
project
.
default_branch
%>
"
tags:
- "runner-for-
<%=
project
.
group
.
name
%>
"
\ No newline at end of file
qa/qa/fixtures/package_managers/npm/package_instance.json.erb
0 → 100644
View file @
e848e5e0
{
"name": "
<%=
package
.
name
%>
",
"version": "1.0.0",
"description": "Example package for GitLab npm registry",
"publishConfig": {
"@
<%=
registry_scope
%>
:registry": "
<%=
gitlab_address_with_port
%>
/api/v4/projects/
<%=
project
.
id
%>
/packages/npm/"
}
}
\ No newline at end of file
qa/qa/fixtures/package_managers/npm/package_project.json.erb
0 → 100644
View file @
e848e5e0
{
"name": "
<%=
package
.
name
%>
",
"version": "1.0.0",
"description": "Example package for GitLab npm registry",
"publishConfig": {
"@
<%=
registry_scope
%>
:registry": "
<%=
gitlab_address_with_port
%>
/api/v4/projects/
<%=
project
.
id
%>
/packages/npm/"
}
}
\ No newline at end of file
qa/qa/fixtures/package_managers/nuget/nuget_install_package.yaml.erb
0 → 100644
View file @
e848e5e0
image: mcr.microsoft.com/dotnet/sdk:5.0
stages:
- install
install:
stage: install
script:
- dotnet nuget locals all --clear
- dotnet nuget add source "$CI_SERVER_URL/api/v4/groups/
<%=
another_project
.
group
.
id
%>
/-/packages/nuget/index.json" --name gitlab --username
<%=
auth_token_username
%>
--password
<%=
auth_token_password
%>
--store-password-in-clear-text
- "dotnet add otherdotnet.csproj package
<%=
package
.
name
%>
--version 1.0.0"
only:
- "
<%=
another_project
.
default_branch
%>
"
tags:
- "runner-for-
<%=
project
.
group
.
name
%>
"
\ No newline at end of file
qa/qa/fixtures/package_managers/nuget/nuget_upload_package.yaml.erb
0 → 100644
View file @
e848e5e0
image: mcr.microsoft.com/dotnet/sdk:5.0
stages:
- deploy
deploy:
stage: deploy
script:
- dotnet restore -p:Configuration=Release
- dotnet build -c Release
- dotnet pack -c Release -p:PackageID=
<%=
package
.
name
%>
- dotnet nuget add source "$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/packages/nuget/index.json" --name gitlab --username
<%=
auth_token_username
%>
--password
<%=
auth_token_password
%>
--store-password-in-clear-text
- dotnet nuget push "bin/Release/*.nupkg" --source gitlab
rules:
- if: '$CI_COMMIT_BRANCH == "
<%=
project
.
default_branch
%>
"'
tags:
- "runner-for-
<%=
project
.
group
.
name
%>
"
\ No newline at end of file
qa/qa/fixtures/package_managers/pypi/pypi_upload_install_package.yaml.erb
0 → 100644
View file @
e848e5e0
image: python:latest
stages:
- run
- install
run:
stage: run
script:
- pip install twine
- python setup.py sdist bdist_wheel
- "TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url
<%=
gitlab_address_with_port
%>
/api/v4/projects/${CI_PROJECT_ID}/packages/pypi dist/*"
tags:
- runner-for-
<%=
project
.
name
%>
install:
stage: install
script:
- "pip install
<%=
package
.
name
%>
--no-deps --index-url
<%=
uri
.
scheme
%>
://
<%=
personal_access_token
%>
:
<%=
personal_access_token
%>
@
<%=
gitlab_host_with_port
%>
/api/v4/projects/${CI_PROJECT_ID}/packages/pypi/simple --trusted-host
<%=
gitlab_host_with_port
%>
"
tags:
- runner-for-
<%=
project
.
name
%>
\ No newline at end of file
qa/qa/fixtures/package_managers/pypi/setup.py.erb
0 → 100644
View file @
e848e5e0
import setuptools
setuptools.setup(
name="
<%=
package
.
name
%>
",
version="0.0.1",
author="Example Author",
author_email="author@example.com",
description="A small example package",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
)
\ No newline at end of file
qa/qa/fixtures/package_managers/rubygems/package.gemspec.erb
0 → 100644
View file @
e848e5e0
# frozen_string_literal: true
Gem::Specification.new do |s|
s.name = '
<%=
package
.
name
%>
'
s.authors = ['Tanuki Steve', 'Hal 9000']
s.author = 'Tanuki Steve'
s.version = '0.0.1'
s.date = '2011-09-29'
s.summary = 'this is a test package'
s.files = ['lib/hello_gem.rb']
s.require_paths = ['lib']
s.description = 'A test package for GitLab.'
s.email = 'tanuki@not_real.com'
s.homepage = 'https://gitlab.com/ruby-co/my-package'
s.license = 'MIT'
s.metadata = {
'bug_tracker_uri' => 'https://gitlab.com/ruby-co/my-package/issues',
'changelog_uri' => 'https://gitlab.com/ruby-co/my-package/CHANGELOG.md',
'documentation_uri' => 'https://gitlab.com/ruby-co/my-package/docs',
'mailing_list_uri' => 'https://gitlab.com/ruby-co/my-package/mailme',
'source_code_uri' => 'https://gitlab.com/ruby-co/my-package'
}
s.bindir = 'bin'
s.platform = Gem::Platform::RUBY
s.post_install_message = 'Installed, thank you!'
s.rdoc_options = ['--main']
s.required_ruby_version = '>= 2.7.0'
s.required_rubygems_version = '>= 1.8.11'
s.requirements = 'A high powered server or calculator'
s.rubygems_version = '1.8.09'
s.add_dependency 'dependency_1', '~> 1.2.3'
s.add_dependency 'dependency_2', '3.0.0'
s.add_dependency 'dependency_3', '>= 1.0.0'
s.add_dependency 'dependency_4'
end
\ No newline at end of file
qa/qa/fixtures/package_managers/rubygems/rubygems_upload_package.yaml.erb
0 → 100644
View file @
e848e5e0
image: ruby
test_package:
stage: deploy
before_script:
- mkdir ~/.gem
- echo "---" > ~/.gem/credentials
- |
echo "
<%=
gitlab_address_with_port
%>
/api/v4/projects/${CI_PROJECT_ID}/packages/rubygems: '${CI_JOB_TOKEN}'" >> ~/.gem/credentials
- chmod 0600 ~/.gem/credentials
script:
- gem build
<%=
package
.
name
%>
- gem push
<%=
package
.
name
%>
-0.0.1.gem --host
<%=
gitlab_address_with_port
%>
/api/v4/projects/${CI_PROJECT_ID}/packages/rubygems
tags:
- runner-for-
<%=
project
.
name
%>
\ No newline at end of file
qa/qa/runtime/fixtures.rb
View file @
e848e5e0
...
...
@@ -33,6 +33,14 @@ module QA
FileUtils
.
remove_entry
(
dir
,
true
)
end
def
read_fixture
(
fixture_path
,
file_name
)
file_path
=
Pathname
.
new
(
__dir__
)
.
join
(
"../fixtures/
#{
fixture_path
}
/
#{
file_name
}
"
)
File
.
read
(
file_path
)
end
private
def
api_client
...
...
qa/qa/specs/features/browser_ui/5_package/package_registry/composer_registry_spec.rb
View file @
e848e5e0
...
...
@@ -32,55 +32,22 @@ module QA
"
#{
uri
.
scheme
}
://
#{
uri
.
host
}
:
#{
uri
.
port
}
"
end
let
(
:composer_json_file
)
do
<<~
EOF
{
"name": "
#{
project
.
path_with_namespace
}
/
#{
package
.
name
}
",
"description": "Library XY",
"type": "library",
"license": "GPL-3.0-only",
"authors": [
{
"name": "John Doe",
"email": "john@example.com"
}
],
"require": {}
}
EOF
end
let
(
:gitlab_ci_yaml
)
do
<<~
YAML
publish:
image: curlimages/curl:latest
stage: build
variables:
URL: "$CI_SERVER_PROTOCOL://$CI_SERVER_HOST:$CI_SERVER_PORT/api/v4/projects/$CI_PROJECT_ID/packages/composer?job_token=$CI_JOB_TOKEN"
script:
- version=$([[ -z "$CI_COMMIT_TAG" ]] && echo "branch=$CI_COMMIT_REF_NAME" || echo "tag=$CI_COMMIT_TAG")
- insecure=$([ "$CI_SERVER_PROTOCOL" = "http" ] && echo "--insecure" || echo "")
- response=$(curl -s -w "%{http_code}" $insecure --data $version $URL)
- code=$(echo "$response" | tail -n 1)
- body=$(echo "$response" | head -n 1)
tags:
- "runner-for-
#{
project
.
name
}
"
YAML
end
before
do
Flow
::
Login
.
sign_in
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
3
,
sleep_interval:
2
)
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
composer_yaml
=
ERB
.
new
(
read_fixture
(
'package_managers/composer'
,
'composer_upload_package.yaml.erb'
)).
result
(
binding
)
composer_json
=
ERB
.
new
(
read_fixture
(
'package_managers/composer'
,
'composer.json.erb'
)).
result
(
binding
)
commit
.
project
=
project
commit
.
commit_message
=
'Add
.gitlab-ci.yml
'
commit
.
commit_message
=
'Add
files
'
commit
.
add_files
([{
file_path:
'.gitlab-ci.yml'
,
content:
gitlab_ci
_yaml
content:
composer
_yaml
},
{
file_path:
'composer.json'
,
content:
composer_json
_file
content:
composer_json
}]
)
end
...
...
qa/qa/specs/features/browser_ui/5_package/package_registry/conan_repository_spec.rb
View file @
e848e5e0
...
...
@@ -46,25 +46,13 @@ module QA
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
3
,
sleep_interval:
2
)
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
conan_yaml
=
ERB
.
new
(
read_fixture
(
'package_managers/conan'
,
'conan_upload_install_package.yaml.erb'
)).
result
(
binding
)
commit
.
project
=
project
commit
.
commit_message
=
'Add .gitlab-ci.yml'
commit
.
add_files
([{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
image: conanio/gcc7
test_package:
stage: deploy
script:
- "conan remote add gitlab
#{
gitlab_address_with_port
}
/api/v4/projects/
#{
project
.
id
}
/packages/conan"
- "conan new
#{
package
.
name
}
/0.1 -t"
- "conan create . mycompany/stable"
- "CONAN_LOGIN_USERNAME=ci_user CONAN_PASSWORD=${CI_JOB_TOKEN} conan upload
#{
package
.
name
}
/0.1@mycompany/stable --all --remote=gitlab"
- "conan install
#{
package
.
name
}
/0.1@mycompany/stable --remote=gitlab"
tags:
- "runner-for-
#{
project
.
name
}
"
YAML
content:
conan_yaml
}])
end
end
...
...
qa/qa/specs/features/browser_ui/5_package/package_registry/generic_repository_spec.rb
View file @
e848e5e0
...
...
@@ -3,6 +3,8 @@
module
QA
RSpec
.
describe
'Package'
,
:orchestrated
,
:packages
,
:object_storage
do
describe
'Generic Repository'
do
include
Runtime
::
Fixtures
let
(
:project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'generic-package-project'
...
...
@@ -25,29 +27,6 @@ module QA
end
end
let
(
:gitlab_ci_yaml
)
do
<<~
YAML
image: curlimages/curl:latest
stages:
- upload
- download
upload:
stage: upload
script:
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file file.txt ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/
#{
package
.
name
}
/0.0.1/file.txt'
tags:
- "runner-for-
#{
project
.
name
}
"
download:
stage: download
script:
- 'wget --header="JOB-TOKEN: $CI_JOB_TOKEN" ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/
#{
package
.
name
}
/0.0.1/file.txt -O file_downloaded.txt'
tags:
- "runner-for-
#{
project
.
name
}
"
YAML
end
let
(
:file_txt
)
do
<<~
EOF
Hello, world!
...
...
@@ -59,11 +38,13 @@ module QA
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
3
,
sleep_interval:
2
)
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
generic_packages_yaml
=
ERB
.
new
(
read_fixture
(
'package_managers/generic'
,
'generic_upload_install_package.yaml.erb'
)).
result
(
binding
)
commit
.
project
=
project
commit
.
commit_message
=
'Add
.gitlab-ci.yml
'
commit
.
commit_message
=
'Add
files
'
commit
.
add_files
([{
file_path:
'.gitlab-ci.yml'
,
content:
g
itlab_ci
_yaml
content:
g
eneric_packages
_yaml
},
{
file_path:
'file.txt'
,
...
...
qa/qa/specs/features/browser_ui/5_package/package_registry/helm_registry_spec.rb
View file @
e848e5e0
...
...
@@ -10,64 +10,6 @@ module QA
let
(
:package_version
)
{
'1.3.7'
}
let
(
:package_type
)
{
'helm'
}
let
(
:package_gitlab_ci_file
)
do
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
deploy:
image: alpine:3
script:
- apk add helm --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
- apk add curl
- helm create
#{
package_name
}
- cp ./Chart.yaml
#{
package_name
}
- helm package
#{
package_name
}
- http_code=$(curl --write-out "%{http_code}" --request POST --form 'chart=@
#{
package_name
}
-
#{
package_version
}
.tgz' --user
#{
username
}
:
#{
access_token
}
${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/stable/charts --output /dev/null --silent)
- '[ $http_code = "201" ]'
only:
- "
#{
package_project
.
default_branch
}
"
tags:
- "runner-for-
#{
package_project
.
group
.
name
}
"
YAML
}
end
let
(
:package_chart_yaml_file
)
do
{
file_path:
"Chart.yaml"
,
content:
<<~
EOF
apiVersion: v2
name:
#{
package_name
}
description: GitLab QA helm package
type: application
version:
#{
package_version
}
appVersion: "1.16.0"
EOF
}
end
let
(
:client_gitlab_ci_file
)
do
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
pull:
image: alpine:3
script:
- apk add helm --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
- helm repo add --username
#{
username
}
--password
#{
access_token
}
gitlab_qa ${CI_API_V4_URL}/projects/
#{
package_project
.
id
}
/packages/helm/stable
- helm repo update
- helm pull gitlab_qa/
#{
package_name
}
only:
- "
#{
client_project
.
default_branch
}
"
tags:
- "runner-for-
#{
client_project
.
group
.
name
}
"
YAML
}
end
%i[personal_access_token ci_job_token project_deploy_token]
.
each
do
|
authentication_token_type
|
context
"using a
#{
authentication_token_type
}
"
do
let
(
:username
)
do
...
...
@@ -95,9 +37,21 @@ module QA
it
"pushes and pulls a helm chart"
do
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
3
,
sleep_interval:
2
)
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
helm_upload_yaml
=
ERB
.
new
(
read_fixture
(
'package_managers/helm'
,
'helm_upload_package.yaml.erb'
)).
result
(
binding
)
helm_chart_yaml
=
ERB
.
new
(
read_fixture
(
'package_managers/helm'
,
'Chart.yaml.erb'
)).
result
(
binding
)
commit
.
project
=
package_project
commit
.
commit_message
=
'Add .gitlab-ci.yml'
commit
.
add_files
([
package_gitlab_ci_file
,
package_chart_yaml_file
])
commit
.
add_files
([
{
file_path:
'.gitlab-ci.yml'
,
content:
helm_upload_yaml
},
{
file_path:
'Chart.yaml'
,
content:
helm_chart_yaml
}
])
end
end
...
...
@@ -127,9 +81,16 @@ module QA
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
3
,
sleep_interval:
2
)
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
helm_install_yaml
=
ERB
.
new
(
read_fixture
(
'package_managers/helm'
,
'helm_install_package.yaml.erb'
)).
result
(
binding
)
commit
.
project
=
client_project
commit
.
commit_message
=
'Add .gitlab-ci.yml'
commit
.
add_files
([
client_gitlab_ci_file
])
commit
.
add_files
([
{
file_path:
'.gitlab-ci.yml'
,
content:
helm_install_yaml
}
])
end
end
...
...
qa/qa/specs/features/browser_ui/5_package/package_registry/maven_gradle_repository_spec.rb
View file @
e848e5e0
...
...
@@ -13,76 +13,6 @@ module QA
let
(
:package_version
)
{
'1.3.7'
}
let
(
:package_type
)
{
'maven_gradle'
}
let
(
:package_gitlab_ci_file
)
do
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
deploy:
image: gradle:6.5-jdk11
script:
- 'gradle publish'
only:
- "
#{
package_project
.
default_branch
}
"
tags:
- "runner-for-
#{
package_project
.
group
.
name
}
"
YAML
}
end
let
(
:package_build_gradle_file
)
do
{
file_path:
'build.gradle'
,
content:
<<~
EOF
plugins {
id 'java'
id 'maven-publish'
}
publishing {
publications {
library(MavenPublication) {
groupId '
#{
group_id
}
'
artifactId '
#{
artifact_id
}
'
version '
#{
package_version
}
'
from components.java
}
}
repositories {
maven {
url "
#{
gitlab_address_with_port
}
/api/v4/projects/
#{
package_project
.
id
}
/packages/maven"
credentials(HttpHeaderCredentials) {
name = "Private-Token"
value = "
#{
personal_access_token
}
"
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}
EOF
}
end
let
(
:client_gitlab_ci_file
)
do
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
build:
image: gradle:6.5-jdk11
script:
- 'gradle build'
only:
- "
#{
client_project
.
default_branch
}
"
tags:
- "runner-for-
#{
client_project
.
group
.
name
}
"
YAML
}
end
where
(
:authentication_token_type
,
:maven_header_name
)
do
:personal_access_token
|
'Private-Token'
:ci_job_token
|
'Job-Token'
...
...
@@ -101,49 +31,24 @@ module QA
end
end
let
(
:client_build_gradle_file
)
do
{
file_path:
'build.gradle'
,
content:
<<~
EOF
plugins {
id 'java'
id 'application'
}
repositories {
jcenter()
maven {
url "
#{
gitlab_address_with_port
}
/api/v4/projects/
#{
package_project
.
id
}
/packages/maven"
name "GitLab"
credentials(HttpHeaderCredentials) {
name = '
#{
maven_header_name
}
'
value =
#{
token
}
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
dependencies {
implementation group: '
#{
group_id
}
', name: '
#{
artifact_id
}
', version: '
#{
package_version
}
'
testImplementation 'junit:junit:4.12'
}
application {
mainClassName = 'gradle_maven_app.App'
}
EOF
}
end
it
"pushes and pulls a maven package via gradle using
#{
params
[
:authentication_token_type
]
}
"
do
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
3
,
sleep_interval:
2
)
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
gradle_upload_yaml
=
ERB
.
new
(
read_fixture
(
'package_managers/maven'
,
'gradle_upload_package.yaml.erb'
)).
result
(
binding
)
build_upload_gradle
=
ERB
.
new
(
read_fixture
(
'package_managers/maven'
,
'build_upload.gradle.erb'
)).
result
(
binding
)
commit
.
project
=
package_project
commit
.
commit_message
=
'Add .gitlab-ci.yml'
commit
.
add_files
([
package_gitlab_ci_file
,
package_build_gradle_file
])
commit
.
add_files
([
{
file_path:
'.gitlab-ci.yml'
,
content:
gradle_upload_yaml
},
{
file_path:
'build.gradle'
,
content:
build_upload_gradle
}
])
end
end
...
...
@@ -173,9 +78,21 @@ module QA
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
3
,
sleep_interval:
2
)
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
gradle_install_yaml
=
ERB
.
new
(
read_fixture
(
'package_managers/maven'
,
'gradle_install_package.yaml.erb'
)).
result
(
binding
)
build_install_gradle
=
ERB
.
new
(
read_fixture
(
'package_managers/maven'
,
'build_install.gradle.erb'
)).
result
(
binding
)
commit
.
project
=
client_project
commit
.
commit_message
=
'Add .gitlab-ci.yml'
commit
.
add_files
([
client_gitlab_ci_file
,
client_build_gradle_file
])
commit
.
commit_message
=
'Add files'
commit
.
add_files
([
{
file_path:
'.gitlab-ci.yml'
,
content:
gradle_install_yaml
},
{
file_path:
'build.gradle'
,
content:
build_install_gradle
}
])
end
end
...
...
qa/qa/specs/features/browser_ui/5_package/package_registry/maven_repository_spec.rb
View file @
e848e5e0
...
...
@@ -13,121 +13,6 @@ module QA
let
(
:package_version
)
{
'1.3.7'
}
let
(
:package_type
)
{
'maven'
}
let
(
:package_gitlab_ci_file
)
do
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
deploy:
image: maven:3.6-jdk-11
script:
- 'mvn deploy -s settings.xml'
only:
- "
#{
package_project
.
default_branch
}
"
tags:
- "runner-for-
#{
package_project
.
group
.
name
}
"
YAML
}
end
let
(
:package_pom_file
)
do
{
file_path:
'pom.xml'
,
content:
<<~
XML
<project>
<groupId>
#{
group_id
}
</groupId>
<artifactId>
#{
artifact_id
}
</artifactId>
<version>
#{
package_version
}
</version>
<modelVersion>4.0.0</modelVersion>
<repositories>
<repository>
<id>
#{
package_project
.
name
}
</id>
<url>
#{
gitlab_address_with_port
}
/api/v4/groups/
#{
package_project
.
group
.
id
}
/-/packages/maven</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>
#{
package_project
.
name
}
</id>
<url>
#{
gitlab_address_with_port
}
/api/v4/projects/
#{
package_project
.
id
}
/packages/maven</url>
</repository>
<snapshotRepository>
<id>
#{
package_project
.
name
}
</id>
<url>
#{
gitlab_address_with_port
}
/api/v4/projects/
#{
package_project
.
id
}
/packages/maven</url>
</snapshotRepository>
</distributionManagement>
</project>
XML
}
end
let
(
:client_gitlab_ci_file
)
do
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
install:
image: maven:3.6-jdk-11
script:
- "mvn install -s settings.xml"
only:
- "
#{
client_project
.
default_branch
}
"
tags:
- "runner-for-
#{
client_project
.
group
.
name
}
"
YAML
}
end
let
(
:client_pom_file
)
do
{
file_path:
'pom.xml'
,
content:
<<~
XML
<project>
<groupId>
#{
group_id
}
</groupId>
<artifactId>maven_client</artifactId>
<version>1.0</version>
<modelVersion>4.0.0</modelVersion>
<repositories>
<repository>
<id>
#{
package_project
.
name
}
</id>
<url>
#{
gitlab_address_with_port
}
/api/v4/groups/
#{
package_project
.
group
.
id
}
/-/packages/maven</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>
#{
group_id
}
</groupId>
<artifactId>
#{
artifact_id
}
</artifactId>
<version>
#{
package_version
}
</version>
</dependency>
</dependencies>
</project>
XML
}
end
let
(
:settings_xml_with_pat
)
do
{
file_path:
'settings.xml'
,
content:
<<~
XML
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<servers>
<server>
<id>
#{
package_project
.
name
}
</id>
<configuration>
<httpHeaders>
<property>
<name>Private-Token</name>
<value>
#{
personal_access_token
}
</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>
XML
}
end
where
(
:authentication_token_type
,
:maven_header_name
)
do
:personal_access_token
|
'Private-Token'
:ci_job_token
|
'Job-Token'
...
...
@@ -146,39 +31,28 @@ module QA
end
end
let
(
:settings_xml
)
do
{
file_path:
'settings.xml'
,
content:
<<~
XML
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<servers>
<server>
<id>
#{
package_project
.
name
}
</id>
<configuration>
<httpHeaders>
<property>
<name>
#{
maven_header_name
}
</name>
<value>
#{
token
}
</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>
XML
}
end
it
"pushes and pulls a maven package via maven using
#{
params
[
:authentication_token_type
]
}
"
do
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
3
,
sleep_interval:
2
)
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
maven_upload_package_yaml
=
ERB
.
new
(
read_fixture
(
'package_managers/maven'
,
'maven_upload_package.yaml.erb'
)).
result
(
binding
)
package_pom_xml
=
ERB
.
new
(
read_fixture
(
'package_managers/maven'
,
'package_pom.xml.erb'
)).
result
(
binding
)
settings_xml
=
ERB
.
new
(
read_fixture
(
'package_managers/maven'
,
'settings.xml.erb'
)).
result
(
binding
)
commit
.
project
=
package_project
commit
.
commit_message
=
'Add
.gitlab-ci.yml
'
commit
.
commit_message
=
'Add
files
'
commit
.
add_files
([
package_gitlab_ci_file
,
package_pom_file
,
settings_xml
{
file_path:
'.gitlab-ci.yml'
,
content:
maven_upload_package_yaml
},
{
file_path:
'pom.xml'
,
content:
package_pom_xml
},
{
file_path:
'settings.xml'
,
content:
settings_xml
}
])
end
end
...
...
@@ -209,12 +83,25 @@ module QA
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
3
,
sleep_interval:
2
)
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
maven_install_package_yaml
=
ERB
.
new
(
read_fixture
(
'package_managers/maven'
,
'maven_install_package.yaml.erb'
)).
result
(
binding
)
client_pom_xml
=
ERB
.
new
(
read_fixture
(
'package_managers/maven'
,
'client_pom.xml.erb'
)).
result
(
binding
)
settings_xml
=
ERB
.
new
(
read_fixture
(
'package_managers/maven'
,
'settings.xml.erb'
)).
result
(
binding
)
commit
.
project
=
client_project
commit
.
commit_message
=
'Add
.gitlab-ci.yml
'
commit
.
commit_message
=
'Add
files
'
commit
.
add_files
([
client_gitlab_ci_file
,
client_pom_file
,
settings_xml
{
file_path:
'.gitlab-ci.yml'
,
content:
maven_install_package_yaml
},
{
file_path:
'pom.xml'
,
content:
client_pom_xml
},
{
file_path:
'settings.xml'
,
content:
settings_xml
}
])
end
end
...
...
@@ -278,7 +165,19 @@ module QA
end
def
create_duplicated_package
with_fixtures
([
package_pom_file
,
settings_xml_with_pat
])
do
|
dir
|
settings_xml_with_pat
=
ERB
.
new
(
read_fixture
(
'package_managers/maven'
,
'settings_with_pat.xml.erb'
)).
result
(
binding
)
package_pom_xml
=
ERB
.
new
(
read_fixture
(
'package_managers/maven'
,
'package_pom.xml.erb'
)).
result
(
binding
)
with_fixtures
([
{
file_path:
'pom.xml'
,
content:
package_pom_xml
},
{
file_path:
'settings.xml'
,
content:
settings_xml_with_pat
}
])
do
|
dir
|
Service
::
DockerRun
::
Maven
.
new
(
dir
).
publish!
end
...
...
@@ -294,12 +193,25 @@ module QA
def
push_duplicated_package
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
3
,
sleep_interval:
2
)
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
maven_upload_package_yaml
=
ERB
.
new
(
read_fixture
(
'package_managers/maven'
,
'maven_upload_package.yaml.erb'
)).
result
(
binding
)
package_pom_xml
=
ERB
.
new
(
read_fixture
(
'package_managers/maven'
,
'package_pom.xml.erb'
)).
result
(
binding
)
settings_xml
=
ERB
.
new
(
read_fixture
(
'package_managers/maven'
,
'settings.xml.erb'
)).
result
(
binding
)
commit
.
project
=
client_project
commit
.
commit_message
=
'Add .gitlab-ci.yml'
commit
.
add_files
([
package_gitlab_ci_file
,
package_pom_file
,
settings_xml
{
file_path:
'.gitlab-ci.yml'
,
content:
maven_upload_package_yaml
},
{
file_path:
'pom.xml'
,
content:
package_pom_xml
},
{
file_path:
'settings.xml'
,
content:
settings_xml
}
])
end
end
...
...
qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_instance_level_spec.rb
View file @
e848e5e0
...
...
@@ -54,75 +54,6 @@ module QA
end
end
let
(
:gitlab_ci_deploy_yaml
)
do
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
image: node:latest
stages:
- deploy
deploy:
stage: deploy
script:
- echo "//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=
#{
auth_token
}
">.npmrc
- npm publish
only:
- "
#{
project
.
default_branch
}
"
tags:
- "runner-for-
#{
project
.
group
.
name
}
"
YAML
}
end
let
(
:gitlab_ci_install_yaml
)
do
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
image: node:latest
stages:
- install
install:
stage: install
script:
- "npm config set @
#{
registry_scope
}
:registry
#{
gitlab_address_with_port
}
/api/v4/packages/npm/"
- "npm install
#{
package
.
name
}
"
cache:
key: ${CI_BUILD_REF_NAME}
paths:
- node_modules/
artifacts:
paths:
- node_modules/
only:
- "
#{
another_project
.
default_branch
}
"
tags:
- "runner-for-
#{
another_project
.
group
.
name
}
"
YAML
}
end
let
(
:package_json
)
do
{
file_path:
'package.json'
,
content:
<<~
JSON
{
"name": "
#{
package
.
name
}
",
"version": "1.0.0",
"description": "Example package for GitLab npm registry",
"publishConfig": {
"@
#{
registry_scope
}
:registry": "
#{
gitlab_address_with_port
}
/api/v4/projects/
#{
project
.
id
}
/packages/npm/"
}
}
JSON
}
end
let
(
:package
)
do
Resource
::
Package
.
init
do
|
package
|
package
.
name
=
"@
#{
registry_scope
}
/
#{
project
.
name
}
-
#{
SecureRandom
.
hex
(
8
)
}
"
...
...
@@ -157,12 +88,21 @@ module QA
it
"push and pull a npm package via CI using a
#{
params
[
:token_name
]
}
"
do
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
3
,
sleep_interval:
2
)
do
npm_upload_yaml
=
ERB
.
new
(
read_fixture
(
'package_managers/npm'
,
'npm_upload_package_instance.yaml.erb'
)).
result
(
binding
)
package_json
=
ERB
.
new
(
read_fixture
(
'package_managers/npm'
,
'package_instance.json.erb'
)).
result
(
binding
)
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
commit
.
project
=
project
commit
.
commit_message
=
'Add
.gitlab-ci.yml
'
commit
.
commit_message
=
'Add
files
'
commit
.
add_files
([
gitlab_ci_deploy_yaml
,
package_json
{
file_path:
'.gitlab-ci.yml'
,
content:
npm_upload_yaml
},
{
file_path:
'package.json'
,
content:
package_json
}
])
end
end
...
...
@@ -180,10 +120,15 @@ module QA
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
3
,
sleep_interval:
2
)
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
npm_install_yaml
=
ERB
.
new
(
read_fixture
(
'package_managers/npm'
,
'npm_install_package_instance.yaml.erb'
)).
result
(
binding
)
commit
.
project
=
another_project
commit
.
commit_message
=
'Add .gitlab-ci.yml'
commit
.
add_files
([
gitlab_ci_install_yaml
{
file_path:
'.gitlab-ci.yml'
,
content:
npm_install_yaml
}
])
end
end
...
...
qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_project_level_spec.rb
View file @
e848e5e0
...
...
@@ -46,62 +46,6 @@ module QA
end
end
let
(
:gitlab_ci_yaml
)
do
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
image: node:latest
stages:
- deploy
- install
deploy:
stage: deploy
script:
- echo "//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=
#{
auth_token
}
">.npmrc
- npm publish
only:
- "
#{
project
.
default_branch
}
"
tags:
- "runner-for-
#{
project
.
name
}
"
install:
stage: install
script:
- "npm config set @
#{
registry_scope
}
:registry
#{
gitlab_address_with_port
}
/api/v4/projects/${CI_PROJECT_ID}/packages/npm/"
- "npm install
#{
package
.
name
}
"
cache:
key: ${CI_BUILD_REF_NAME}
paths:
- node_modules/
artifacts:
paths:
- node_modules/
only:
- "
#{
project
.
default_branch
}
"
tags:
- "runner-for-
#{
project
.
name
}
"
YAML
}
end
let
(
:package_json
)
do
{
file_path:
'package.json'
,
content:
<<~
JSON
{
"name": "
#{
package
.
name
}
",
"version": "1.0.0",
"description": "Example package for GitLab npm registry",
"publishConfig": {
"@
#{
registry_scope
}
:registry": "
#{
gitlab_address_with_port
}
/api/v4/projects/
#{
project
.
id
}
/packages/npm/"
}
}
JSON
}
end
let
(
:package
)
do
Resource
::
Package
.
init
do
|
package
|
package
.
name
=
"@
#{
registry_scope
}
/mypackage-
#{
SecureRandom
.
hex
(
8
)
}
"
...
...
@@ -135,11 +79,20 @@ module QA
it
"push and pull a npm package via CI using a
#{
params
[
:token_name
]
}
"
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
npm_upload_install_yaml
=
ERB
.
new
(
read_fixture
(
'package_managers/npm'
,
'npm_upload_install_package_project.yaml.erb'
)).
result
(
binding
)
package_json
=
ERB
.
new
(
read_fixture
(
'package_managers/npm'
,
'package_project.json.erb'
)).
result
(
binding
)
commit
.
project
=
project
commit
.
commit_message
=
'Add .gitlab-ci.yml'
commit
.
add_files
([
gitlab_ci_yaml
,
package_json
{
file_path:
'.gitlab-ci.yml'
,
content:
npm_upload_install_yaml
},
{
file_path:
'package.json'
,
content:
package_json
}
])
end
...
...
qa/qa/specs/features/browser_ui/5_package/package_registry/nuget_repository_spec.rb
View file @
e848e5e0
...
...
@@ -5,6 +5,7 @@ module QA
describe
'NuGet Repository'
do
using
RSpec
::
Parameterized
::
TableSyntax
include
Runtime
::
Fixtures
let
(
:project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'nuget-package-project'
...
...
@@ -96,31 +97,14 @@ module QA
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
3
,
sleep_interval:
2
)
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
nuget_upload_yaml
=
ERB
.
new
(
read_fixture
(
'package_managers/nuget'
,
'nuget_upload_package.yaml.erb'
)).
result
(
binding
)
commit
.
project
=
project
commit
.
commit_message
=
'Add .gitlab-ci.yml'
commit
.
update_files
(
[
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
image: mcr.microsoft.com/dotnet/sdk:5.0
stages:
- deploy
deploy:
stage: deploy
script:
- dotnet restore -p:Configuration=Release
- dotnet build -c Release
- dotnet pack -c Release -p:PackageID=
#{
package
.
name
}
- dotnet nuget add source "$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/packages/nuget/index.json" --name gitlab --username
#{
auth_token_username
}
--password
#{
auth_token_password
}
--store-password-in-clear-text
- dotnet nuget push "bin/Release/*.nupkg" --source gitlab
rules:
- if: '$CI_COMMIT_BRANCH == "
#{
project
.
default_branch
}
"'
tags:
- "runner-for-
#{
project
.
group
.
name
}
"
YAML
content:
nuget_upload_yaml
}
]
)
...
...
@@ -142,6 +126,8 @@ module QA
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
3
,
sleep_interval:
2
)
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
nuget_install_yaml
=
ERB
.
new
(
read_fixture
(
'package_managers/nuget'
,
'nuget_install_package.yaml.erb'
)).
result
(
binding
)
commit
.
project
=
another_project
commit
.
commit_message
=
'Add new csproj file'
commit
.
add_files
(
...
...
@@ -165,23 +151,7 @@ module QA
[
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
image: mcr.microsoft.com/dotnet/sdk:5.0
stages:
- install
install:
stage: install
script:
- dotnet nuget locals all --clear
- dotnet nuget add source "$CI_SERVER_URL/api/v4/groups/
#{
another_project
.
group
.
id
}
/-/packages/nuget/index.json" --name gitlab --username
#{
auth_token_username
}
--password
#{
auth_token_password
}
--store-password-in-clear-text
- "dotnet add otherdotnet.csproj package
#{
package
.
name
}
--version 1.0.0"
only:
- "
#{
another_project
.
default_branch
}
"
tags:
- "runner-for-
#{
project
.
group
.
name
}
"
YAML
content:
nuget_install_yaml
}
]
)
...
...
qa/qa/specs/features/browser_ui/5_package/package_registry/pypi_repository_spec.rb
View file @
e848e5e0
...
...
@@ -4,6 +4,7 @@ module QA
RSpec
.
describe
'Package'
,
:orchestrated
,
:packages
,
:object_storage
do
describe
'PyPI Repository'
do
include
Runtime
::
Fixtures
let
(
:project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'pypi-package-project'
...
...
@@ -36,56 +37,18 @@ module QA
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
3
,
sleep_interval:
2
)
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
pypi_yaml
=
ERB
.
new
(
read_fixture
(
'package_managers/pypi'
,
'pypi_upload_install_package.yaml.erb'
)).
result
(
binding
)
pypi_setup_file
=
ERB
.
new
(
read_fixture
(
'package_managers/pypi'
,
'setup.py.erb'
)).
result
(
binding
)
commit
.
project
=
project
commit
.
commit_message
=
'Add
.gitlab-ci.yml
'
commit
.
commit_message
=
'Add
files
'
commit
.
add_files
([{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
image: python:latest
stages:
- run
- install
run:
stage: run
script:
- pip install twine
- python setup.py sdist bdist_wheel
- "TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url
#{
gitlab_address_with_port
}
/api/v4/projects/${CI_PROJECT_ID}/packages/pypi dist/*"
tags:
- "runner-for-
#{
project
.
name
}
"
install:
stage: install
script:
- "pip install
#{
package
.
name
}
--no-deps --index-url
#{
uri
.
scheme
}
://
#{
personal_access_token
}
:
#{
personal_access_token
}
@
#{
gitlab_host_with_port
}
/api/v4/projects/${CI_PROJECT_ID}/packages/pypi/simple --trusted-host
#{
gitlab_host_with_port
}
"
tags:
- "runner-for-
#{
project
.
name
}
"
YAML
content:
pypi_yaml
},
{
file_path:
'setup.py'
,
content:
<<~
EOF
import setuptools
setuptools.setup(
name="
#{
package
.
name
}
",
version="0.0.1",
author="Example Author",
author_email="author@example.com",
description="A small example package",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
)
EOF
content:
pypi_setup_file
}])
end
end
...
...
qa/qa/specs/features/browser_ui/5_package/package_registry/rubygems_registry_spec.rb
View file @
e848e5e0
...
...
@@ -48,30 +48,16 @@ module QA
Support
::
Retrier
.
retry_on_exception
(
max_attempts:
3
,
sleep_interval:
2
)
do
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
rubygem_upload_yaml
=
ERB
.
new
(
read_fixture
(
'package_managers/rubygems'
,
'rubygems_upload_package.yaml.erb'
)).
result
(
binding
)
rubygem_package_gemspec
=
ERB
.
new
(
read_fixture
(
'package_managers/rubygems'
,
'package.gemspec.erb'
)).
result
(
binding
)
commit
.
project
=
project
commit
.
commit_message
=
'Add package files'
commit
.
add_files
(
[
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
image: ruby
test_package:
stage: deploy
before_script:
- mkdir ~/.gem
- echo "---" > ~/.gem/credentials
- |
echo "
#{
gitlab_address_with_port
}
/api/v4/projects/${CI_PROJECT_ID}/packages/rubygems: '${CI_JOB_TOKEN}'" >> ~/.gem/credentials
- chmod 0600 ~/.gem/credentials
script:
- gem build
#{
package
.
name
}
- gem push
#{
package
.
name
}
-0.0.1.gem --host
#{
gitlab_address_with_port
}
/api/v4/projects/${CI_PROJECT_ID}/packages/rubygems
tags:
- "runner-for-
#{
project
.
name
}
"
YAML
content:
rubygem_upload_yaml
},
{
file_path:
'lib/hello_gem.rb'
,
...
...
@@ -86,49 +72,7 @@ module QA
},
{
file_path:
"
#{
package
.
name
}
.gemspec"
,
content:
<<~
RUBY
# frozen_string_literal: true
Gem::Specification.new do |s|
s.name = '
#{
package
.
name
}
'
s.authors = ['Tanuki Steve', 'Hal 9000']
s.author = 'Tanuki Steve'
s.version = '0.0.1'
s.date = '2011-09-29'
s.summary = 'this is a test package'
s.files = ['lib/hello_gem.rb']
s.require_paths = ['lib']
s.description = 'A test package for GitLab.'
s.email = 'tanuki@not_real.com'
s.homepage = 'https://gitlab.com/ruby-co/my-package'
s.license = 'MIT'
s.metadata = {
'bug_tracker_uri' => 'https://gitlab.com/ruby-co/my-package/issues',
'changelog_uri' => 'https://gitlab.com/ruby-co/my-package/CHANGELOG.md',
'documentation_uri' => 'https://gitlab.com/ruby-co/my-package/docs',
'mailing_list_uri' => 'https://gitlab.com/ruby-co/my-package/mailme',
'source_code_uri' => 'https://gitlab.com/ruby-co/my-package'
}
s.bindir = 'bin'
s.platform = Gem::Platform::RUBY
s.post_install_message = 'Installed, thank you!'
s.rdoc_options = ['--main']
s.required_ruby_version = '>= 2.7.0'
s.required_rubygems_version = '>= 1.8.11'
s.requirements = 'A high powered server or calculator'
s.rubygems_version = '1.8.09'
s.add_dependency 'dependency_1', '~> 1.2.3'
s.add_dependency 'dependency_2', '3.0.0'
s.add_dependency 'dependency_3', '>= 1.0.0'
s.add_dependency 'dependency_4'
end
RUBY
content:
rubygem_package_gemspec
}
]
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment