Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: better support for custom gitlab ports #1368

Merged
merged 11 commits into from
Oct 12, 2024

Conversation

ANGkeith
Copy link
Collaborator

@ANGkeith ANGkeith commented Oct 8, 2024

No description provided.

@ANGkeith ANGkeith marked this pull request as draft October 8, 2024 03:51
@ANGkeith
Copy link
Collaborator Author

ANGkeith commented Oct 8, 2024

@rgalonso

Can you help me to run the following job in your private hosted gitlab and dump the output ? (feel free to redact things you find sensitive)

job:
  script:
    - env | sort | grep -v '^FF_' | grep -v "^RUBY" | grep -v "^GITLAB_FEATURES"

eg. this is the output i get from gitlab.com...

BUNDLE_APP_CONFIG=/usr/local/bundle
BUNDLE_SILENCE_ROOT_WARNING=1
CI=true
CI_API_GRAPHQL_URL=https://gitlab.com/api/graphql
CI_API_V4_URL=https://gitlab.com/api/v4
CI_BUILDS_DIR=/builds
CI_COMMIT_AUTHOR=ANGkeith <angkeith@hotmail.sg>
CI_COMMIT_BEFORE_SHA=e055cf696c33d8d8bcd3a4dd4802f6e6f24d4bdb
CI_COMMIT_BRANCH=feat
CI_COMMIT_DESCRIPTION=
CI_COMMIT_MESSAGE=123
CI_COMMIT_REF_NAME=feat
CI_COMMIT_REF_PROTECTED=false
CI_COMMIT_REF_SLUG=feat
CI_COMMIT_SHA=7ca0e45ec19da978231336d052fcd5d7ffd5c962
CI_COMMIT_SHORT_SHA=7ca0e45e
CI_COMMIT_TIMESTAMP=[20](https://gitlab.com/ANGkeith/shhh/-/jobs/8017348778#L20)24-10-08T11:45:21+08:00
CI_COMMIT_TITLE=123
CI_CONCURRENT_ID=47
CI_CONCURRENT_PROJECT_ID=0
CI_CONFIG_PATH=.gitlab-ci.yml
CI_DEFAULT_BRANCH=develop
CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX=gitlab.com:443/angkeith/dependency_proxy/containers
CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX=gitlab.com:443/angkeith/dependency_proxy/containers
CI_DEPENDENCY_PROXY_PASSWORD=[MASKED]
CI_DEPENDENCY_PROXY_SERVER=gitlab.com:443
CI_DEPENDENCY_PROXY_USER=gitlab-ci-token
CI_DISPOSABLE_ENVIRONMENT=true
CI_JOB_ID=8017348778
CI_JOB_NAME=job
CI_JOB_NAME_SLUG=job
CI_JOB_STAGE=test
CI_JOB_STARTED_AT=2024-10-08T03:45:29Z
CI_JOB_STATUS=running
CI_JOB_TIMEOUT=3600
CI_JOB_TOKEN=[MASKED]
CI_JOB_URL=https://gitlab.com/ANGkeith/shhh/-/jobs/8017348778
CI_NODE_TOTAL=1
CI_PAGES_DOMAIN=gitlab.io
CI_PAGES_URL=https://shhh-angkeith-da4aec9ead7ab2e61def6df77ff17b29185e3916af4f97d33.gitlab.io
CI_PIPELINE_CREATED_AT=2024-10-08T03:45:28Z
CI_PIPELINE_ID=1485743001
CI_PIPELINE_IID=407
CI_PIPELINE_NAME=
CI_PIPELINE_SOURCE=push
CI_PIPELINE_URL=https://gitlab.com/ANGkeith/shhh/-/pipelines/1485743001
CI_PROJECT_CLASSIFICATION_LABEL=
CI_PROJECT_DESCRIPTION=
CI_PROJECT_DIR=/builds/ANGkeith/shhh
CI_PROJECT_ID=55415918
CI_PROJECT_NAME=shhh
CI_PROJECT_NAMESPACE=ANGkeith
CI_PROJECT_NAMESPACE_ID=3746287
CI_PROJECT_PATH=ANGkeith/shhh
CI_PROJECT_PATH_SLUG=angkeith-shhh
CI_PROJECT_REPOSITORY_LANGUAGES=dockerfile,hcl
CI_PROJECT_ROOT_NAMESPACE=ANGkeith
CI_PROJECT_TITLE=Shhh
CI_PROJECT_URL=https://gitlab.com/ANGkeith/shhh
CI_PROJECT_VISIBILITY=private
CI_REGISTRY=registry.gitlab.com
CI_REGISTRY_IMAGE=registry.gitlab.com/angkeith/shhh
CI_REGISTRY_PASSWORD=[MASKED]
CI_REGISTRY_USER=gitlab-ci-token
CI_REPOSITORY_URL=https://gitlab-ci-token:[MASKED]@gitlab.com/ANGkeith/shhh.git
CI_RUNNER_DESCRIPTION=2-blue.saas-linux-small-amd64.runners-manager.gitlab.com/default
CI_RUNNER_EXECUTABLE_ARCH=linux/amd64
CI_RUNNER_ID=12270831
CI_RUNNER_REVISION=27400594
CI_RUNNER_SHORT_TOKEN=XxUrkriX
CI_RUNNER_TAGS=["saas-linux-small-amd64"]
CI_RUNNER_VERSION=17.4.0~pre.110.g27400594
CI_SERVER=yes
CI_SERVER_FQDN=gitlab.com
CI_SERVER_HOST=gitlab.com
CI_SERVER_NAME=GitLab
CI_SERVER_PORT=443
CI_SERVER_PROTOCOL=https
CI_SERVER_REVISION=e630b24[21](https://gitlab.com/ANGkeith/shhh/-/jobs/8017348778#L21)3c
CI_SERVER_SHELL_SSH_HOST=gitlab.com
CI_SERVER_SHELL_SSH_PORT=[22](https://gitlab.com/ANGkeith/shhh/-/jobs/8017348778#L22)
CI_SERVER_TLS_CA_FILE=/builds/ANGkeith/shhh.tmp/CI_SERVER_TLS_CA_FILE
CI_SERVER_URL=https://gitlab.com
CI_SERVER_VERSION=17.5.0-pre
CI_SERVER_VERSION_MAJOR=17
CI_SERVER_VERSION_MINOR=5
CI_SERVER_VERSION_PATCH=0
CI_TEMPLATE_REGISTRY_HOST=registry.gitlab.com
DOCKER_DRIVER=overlay2
DOCKER_IPTABLES_LEGACY=1
DOCKER_TLS_CERTDIR=
GEM_HOME=/usr/local/bundle
GITLAB_CI=true
GITLAB_ENV=/builds/ANGkeith/shhh.tmp/gitlab_runner_env
GITLAB_USER_EMAIL=angkeith@hotmail.sg
GITLAB_USER_ID=[29](https://gitlab.com/ANGkeith/shhh/-/jobs/8017348778#L29)38569
GITLAB_USER_LOGIN=ANGkeith
GITLAB_USER_NAME=ANGkeith
HOME=/root
HOSTNAME=runner-xxurkrix-project-55415918-concurrent-0
LANG=C.UTF-8
OLDPWD=/
PATH=/usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/builds/ANGkeith/shhh
RUNNER_TEMP_PROJECT_DIR=/builds/ANGkeith/shhh.tmp
SHLVL=1
_=/usr/bin/env

@ANGkeith ANGkeith force-pushed the fix/better-support-for-custom-gitlab-ports branch from 869b1fb to a2558a5 Compare October 8, 2024 03:53
@rgalonso
Copy link
Contributor

rgalonso commented Oct 8, 2024

@ANGkeith, in reply to your request:

CI=true
CI_API_GRAPHQL_URL=https://masked.internal.com:5443/api/graphql
CI_API_V4_URL=https://masked.internal.com:5443/api/v4
CI_BUILDS_DIR=/builds
CI_COMMIT_AUTHOR=Robert Alonso <user@masked.internal.com>
CI_COMMIT_BEFORE_SHA=8455a589c27a7fb9d4ee364a8bf49d89ca2dd49b
CI_COMMIT_BRANCH=main
CI_COMMIT_DESCRIPTION=
CI_COMMIT_MESSAGE=mask additional items
CI_COMMIT_REF_NAME=main
CI_COMMIT_REF_PROTECTED=true
CI_COMMIT_REF_SLUG=main
CI_COMMIT_SHA=b66fb2d47afaa57b23a1e98b71406c6a9ca30829
CI_COMMIT_SHORT_SHA=b66fb2d4
CI_COMMIT_TIMESTAMP=2024-10-08T10:38:18-04:00
CI_COMMIT_TITLE=mask additional items
CI_CONCURRENT_ID=0
CI_CONCURRENT_PROJECT_ID=0
CI_CONFIG_PATH=.gitlab-ci.yml
CI_DEFAULT_BRANCH=main
CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX=masked.internal.com:5443/sandbox/user/dependency_proxy/containers
CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX=masked.internal.com:5443/sandbox/dependency_proxy/containers
CI_DEPENDENCY_PROXY_PASSWORD=[MASKED]
CI_DEPENDENCY_PROXY_SERVER=masked.internal.com:5443
CI_DEPENDENCY_PROXY_USER=gitlab-ci-token
CI_DISPOSABLE_ENVIRONMENT=true
CI_JOB_ID=65935
CI_JOB_IMAGE=alpine
CI_JOB_NAME=print-sanitized-environment
CI_JOB_NAME_SLUG=print-sanitized-environment
CI_JOB_STAGE=test
CI_JOB_STARTED_AT=2024-10-08T10:38:21-04:00
CI_JOB_STATUS=running
CI_JOB_TIMEOUT=3600
CI_JOB_TOKEN=[MASKED]
CI_JOB_URL=https://masked.internal.com:5443/sandbox/user/test-gitlab-ci-local/-/jobs/65935
CI_NODE_TOTAL=1
CI_PAGES_DOMAIN=example.com
CI_PAGES_URL=http://sandbox.example.com/user/test-gitlab-ci-local
CI_PIPELINE_CREATED_AT=2024-10-08T10:38:19-04:00
CI_PIPELINE_ID=22302
CI_PIPELINE_IID=3
CI_PIPELINE_NAME=
CI_PIPELINE_SOURCE=push
CI_PIPELINE_URL=https://masked.internal.com:5443/sandbox/user/test-gitlab-ci-local/-/pipelines/22302
CI_PROJECT_CLASSIFICATION_LABEL=
CI_PROJECT_DESCRIPTION=
CI_PROJECT_DIR=/builds/sandbox/user/test-gitlab-ci-local
CI_PROJECT_ID=670
CI_PROJECT_NAME=test-gitlab-ci-local
CI_PROJECT_NAMESPACE=sandbox/user
CI_PROJECT_NAMESPACE_ID=57
CI_PROJECT_PATH=sandbox/user/test-gitlab-ci-local
CI_PROJECT_PATH_SLUG=sandbox-user-test-gitlab-ci-local
CI_PROJECT_REPOSITORY_LANGUAGES=
CI_PROJECT_ROOT_NAMESPACE=sandbox
CI_PROJECT_TITLE=test-gitlab-ci-local
CI_PROJECT_URL=https://masked.internal.com:5443/sandbox/user/test-gitlab-ci-local
CI_PROJECT_VISIBILITY=private
CI_REGISTRY=masked.internal.com:3567
CI_REGISTRY_IMAGE=masked.internal.com:3567/sandbox/user/test-gitlab-ci-local
CI_REGISTRY_PASSWORD=[MASKED]
CI_REGISTRY_USER=gitlab-ci-token
CI_REPOSITORY_URL=https://gitlab-ci-token:[MASKED]@masked.internal.com:5443/sandbox/user/test-gitlab-ci-local.git
CI_RUNNER_DESCRIPTION=untagged internal GitLab
CI_RUNNER_EXECUTABLE_ARCH=linux/amd64
CI_RUNNER_ID=17
CI_RUNNER_REVISION=b92ee590
CI_RUNNER_SHORT_TOKEN=WuBnwooy
CI_RUNNER_TAGS=[]
CI_RUNNER_VERSION=17.4.0
CI_SERVER=yes
CI_SERVER_FQDN=masked.internal.com:5443
CI_SERVER_HOST=masked.internal.com
CI_SERVER_NAME=GitLab
CI_SERVER_PORT=5443
CI_SERVER_PROTOCOL=https
CI_SERVER_REVISION=43150021b52
CI_SERVER_SHELL_SSH_HOST=masked.internal.com
CI_SERVER_SHELL_SSH_PORT=3022
CI_SERVER_TLS_CA_FILE=/builds/sandbox/user/test-gitlab-ci-local.tmp/CI_SERVER_TLS_CA_FILE
CI_SERVER_URL=https://masked.internal.com:5443
CI_SERVER_VERSION=17.4.0
CI_SERVER_VERSION_MAJOR=17
CI_SERVER_VERSION_MINOR=4
CI_SERVER_VERSION_PATCH=0
CI_TEMPLATE_REGISTRY_HOST=registry.gitlab.com
GITLAB_CI=true
GITLAB_ENV=/builds/sandbox/user/test-gitlab-ci-local.tmp/gitlab_runner_env
GITLAB_USER_EMAIL=user@masked.internal.com
GITLAB_USER_ID=2
GITLAB_USER_LOGIN=user
GITLAB_USER_NAME=Robert Alonso
HOME=/root
HOSTNAME=runner-wubnwooy-project-670-concurrent-0
MLM_LICENSE_TOKEN=[MASKED]
OLDPWD=/
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/builds/sandbox/user/test-gitlab-ci-local
RUNNER_TEMP_PROJECT_DIR=/builds/sandbox/user/test-gitlab-ci-local.tmp
SHLVL=2

@rgalonso
Copy link
Contributor

rgalonso commented Oct 8, 2024

Unfortunately, this branch still isn't quite working for me. Please stand by. I'm making several local changes and starting to home in on the solution for working with self-hosted instances on non-default ports. I'll push to a fork once I have it stable.

@rgalonso
Copy link
Contributor

rgalonso commented Oct 9, 2024

Please see PR #1369

@@ -28,19 +58,19 @@ export function init ({gitData, argv}: PredefinedVariablesOpts): {[name: string]
CI_COMMIT_REF_SLUG: gitData.commit.REF_NAME.replace(/[^a-z\d]+/ig, "-").replace(/^-/, "").slice(0, 63).replace(/-$/, "").toLowerCase(),
CI_COMMIT_TIMESTAMP: gitData.commit.TIMESTAMP,
CI_PIPELINE_CREATED_AT: new Date().toISOString().split(".")[0] + "Z",
CI_JOB_STARTED_AT: new Date().toISOString().split(".")[0] + "Z",
Copy link
Collaborator Author

@ANGkeith ANGkeith Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This var is redundant since it'll be ovewritten at a later stage

this._variables["CI_JOB_STARTED_AT"] = new Date().toISOString().split(".")[0] + "Z";

@ANGkeith ANGkeith force-pushed the fix/better-support-for-custom-gitlab-ports branch 2 times, most recently from 5e1f117 to c8df96d Compare October 9, 2024 06:06
ANGkeith and others added 4 commits October 11, 2024 10:28
Co-authored-by: ANGkeith <angkeith@hotmail.sg>
Only print port if it's defined. Update expected
string to match grammar correction in production
source file.
@ANGkeith ANGkeith force-pushed the fix/better-support-for-custom-gitlab-ports branch from 8a04fa7 to 7e0570f Compare October 11, 2024 02:29
@ANGkeith ANGkeith force-pushed the fix/better-support-for-custom-gitlab-ports branch from 7e0570f to 6bb7dec Compare October 11, 2024 02:40
@ANGkeith ANGkeith marked this pull request as ready for review October 11, 2024 02:43
@ANGkeith ANGkeith force-pushed the fix/better-support-for-custom-gitlab-ports branch from 6bb7dec to e16509c Compare October 11, 2024 02:51
README.md Outdated Show resolved Hide resolved
Co-authored-by: Robert Alonso <17463757+rgalonso@users.noreply.github.com>
src/parser-includes.ts Outdated Show resolved Hide resolved
Copy link

sonarcloud bot commented Oct 11, 2024

@firecow firecow merged commit d0be1c3 into master Oct 12, 2024
10 checks passed
@firecow firecow deleted the fix/better-support-for-custom-gitlab-ports branch October 12, 2024 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants