jenkins-x / jx

Jenkins X provides automated CI+CD for Kubernetes with Preview Environments on Pull Requests using Cloud Native pipelines from Tekton
https://jenkins-x.io/
Apache License 2.0
4.56k stars 786 forks source link

`jx boot` environmentGitPrivate key in jx-requirements.yaml #5372

Closed stepanselyuk closed 4 years ago

stepanselyuk commented 5 years ago

Summary

I see the message:

Will create public environment repos, if you want to create private environment repos, please set environmentGitPrivate to true jx-requirements.yaml

Steps to reproduce the behavior

jx boot

Expected behavior

Allow using environmentGitPrivate key in jx-requirements.yaml

Actual behavior

Says there is no environmentGitPrivate key support in the structure and additional fields do not allowed.

Jx version

The output of jx version is:

jx                 2.0.689
Kubernetes cluster v1.13.10-eks-5ac0f1
kubectl            v1.15.3
git                2.23.0
Operating System   Mac OS X 10.14.6 build 18G95

Jenkins type

Kubernetes cluster

Created by eksctl

Operating system / Environment

Operating System Mac OS X 10.14.6 build 18G95

cagiti commented 5 years ago

@stepanselyuk are you able to share and example jx-requirements.yml showing the use of environmentGitPrivate? Thanks

stepanselyuk commented 5 years ago

I've added environmentGitPrivate key on top-level:

cluster:
  clusterName: cdp-dev
  environmentGitOwner: redacted
  gitKind: github
  gitName: github
  gitServer: https://github.com
  namespace: jx
  project: cdp-dev
  provider: eks
  zone: us-west-2
environments:
- key: dev
- key: staging
- key: production
gitops: true
# here
environmentGitPrivate: true
ingress:
  domain: redacted-dev.com
  externalDNS: true
  namespaceSubDomain: -jx.
  tls:
    email: redacted@redacted.com
    enabled: true
    production: true
kaniko: true
secretStorage: vault
storage:
  logs:
    enabled: true
    url: s3://jx-cdp-dev/logs/
  reports:
    enabled: true
    url: s3://jx-cdp-dev/reports/
  repository:
    enabled: true
    url: s3://jx-cdp-dev/repository/
versionStream:
  ref: master
  url: https://github.com/jenkins-x/jenkins-x-versions.git
webhook: prow
langleyd commented 5 years ago

It worked for me when I put it under cluster:

hferentschik commented 5 years ago

FYI, the property will be renamed to environmentGitPublic with this PR https://github.com/jenkins-x/jx/pull/5284. The code should transparently handle this for you, but moving forward private repos will be the default and one has to explicitly make them public.

hferentschik commented 5 years ago

It worked for me when I put it under cluster:

Right, that's the right place. See also https://github.com/jenkins-x/jx/blob/master/pkg/config/install_requirements.go#L178

I guess the message "Will create public environment repos, if you want to create private environment repos, please set environmentGitPrivate to true jx-requirements.yaml" made you believe that you need to add the property on the root level.

Maybe we should reword the message and we need to document jx-requirements.yaml in general.

cagiti commented 5 years ago

FYI, the property will be renamed to environmentGitPublic with this PR #5284. The code should transparently handle this for you, but moving forward private repos will be the default and one has to explicitly make them public.

@hferentschik I don't think this behaviour should be default... I agree it's a great sentiment, however you need a paid account to create private repositories within an organisation (_you can have unlimited private repositories for user accounts).

This only applies when the private repositories are to be created within an organisation... private repositories which are created under a user account can be performed without a subscription.

stepanselyuk commented 5 years ago

Does the schema (validation) for jx-requirements.yaml available?

sdoxsee commented 4 years ago

I've switched to using environmentGitPublic which seems to work for initial install but my dev environment pipeline fails on it (amongst other things). Note: I manually merged after tide said "not mergeable", started the pipeline manually and this was the result.

Showing logs for build simplestepsolutions/environment-boot-cluster-dev/master #1 stage release and container step-verify-preinstall
error: Validation failures in YAML file /workspace/source/jx-requirements.yml:
(root): Additional property autoUpdate is not allowed
cluster: Additional property environmentGitPublic is not allowed
ingress: Additional property cloud_dns_secret_name is not allowed
hferentschik commented 4 years ago

The requirements options is now environmentGitPublic. See also https://jenkins-x.io/docs/reference/config/config/#config.jenkins.io/v1.RequirementsConfig