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

Add validation and uploading of jobs configuration #127

Merged
merged 3 commits into from
Nov 16, 2018
Merged

Add validation and uploading of jobs configuration #127

merged 3 commits into from
Nov 16, 2018

Conversation

hudymi
Copy link
Contributor

@hudymi hudymi commented Nov 15, 2018

Description

Changes proposed in this pull request:

  • Added a simple application that uploads configuration to Prow
  • Enabled validation of job configs

Related issue(s)

See #87

@hudymi hudymi added the WIP label Nov 15, 2018
@hudymi hudymi added area/ci Issues or PRs related to CI related topics wg/prow and removed WIP labels Nov 15, 2018

## Overview

This command is responsible for uploading Prow configuration.
Copy link
Contributor

Choose a reason for hiding this comment

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

be more specific: which configuration

## Overview

This command is responsible for uploading Prow configuration.

Copy link
Contributor

Choose a reason for hiding this comment

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

If I add a new job, should I run this command? Probably not, because we have config updater. We should mention that you update jobs using this tool when a new cluster is provisioned (for production cluster or for "forked" clusters)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added more information.

Copy link
Contributor

Choose a reason for hiding this comment

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

My proposal: Use it for a newly created Prow cluster or to update changes in the configuration on a cluster from a forked repository that does not use config-updater?

return err
}

func uploadFromFiles(name, path string, client configMapSetter) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

consider renaming: updateConfigMapFromDirecotry and uploadFromFile --> updateConfigMapFromFile.
Additionally, it is updating or replacing?


func TestUploadFromFile(t *testing.T) {
//given
tmpDir, err := ioutil.TempDir("", "TestFindAllRec")
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: prefix should be the same as a test name

"path/filepath"
)

func FindAllRec(rootPath, extension string) ([]string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

name of this function is cryptic for me

return &result, nil
}

func configMapFromFiles(name, rootPath string) (*v1.ConfigMap, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: maybe better name will be: configMapFromYamlsInDir


## Usage

To run, use:
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, add information that we make an assumption that configmaps already exist


This command is responsible for uploading Prow configuration.

## Usage
Copy link
Contributor

Choose a reason for hiding this comment

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

If this tool has to be used for production cluster, please update documentation how to configure production cluster

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

| --kubeconfig | Yes | The path to the kubeconfig file, needed for connecting to the cluster. |
| --config-path | No | The path to the `config.yaml` file. If set, the configuration will be uploaded. |
| --jobs-config-path | No | The path to the directory with job configurations. If set, the job configurations will be uploaded. |
| --plugin-config-path | No | The path to the `plugins.yaml` file. If set, the plugins configuration will be uploaded. |
Copy link
Contributor

Choose a reason for hiding this comment

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

I think --plugins-config-path would be better.

return err
}

func configMapFromFile(name, path string) (*v1.ConfigMap, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO we should either merge these two functions or name this one as configMapFromSingleFile. Otherwise, they can be mixed up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed

command:
- "/home/prow/go/src/github.com/kyma-project/test-infra/development/validate-scripts.sh"
- name: prow/test-infra/validate-configs
Copy link
Contributor

Choose a reason for hiding this comment

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

we should have a job to check if config uploader compiles - please fix it here or create a follow up task

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Follow up created: #134

<!-- Update the project structure each time you modify it. -->

```
├── checker # This folder contains code sources of a simple Go application that verifies the configuration of the "config.yaml" and "plugins.yaml" files
├── check.sh # This script runs the "Checker" application. .
├── checker # This folder contains code sources of a simple Go application that verifies the configuration of the "config.yaml", "plugins.yaml" files and job configurations.
Copy link

Choose a reason for hiding this comment

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

Suggested change
├── checker # This folder contains code sources of a simple Go application that verifies the configuration of the "config.yaml", "plugins.yaml" files and job configurations.
├── checker # This folder contains code sources of a simple Go application that verifies the configuration of jobs, "config.yaml", and "plugins.yaml".

├── checker # This folder contains code sources of a simple Go application that verifies the configuration of the "config.yaml" and "plugins.yaml" files
├── check.sh # This script runs the "Checker" application. .
├── checker # This folder contains code sources of a simple Go application that verifies the configuration of the "config.yaml", "plugins.yaml" files and job configurations.
├── tools # This folder contains code sources of a Go applications for test-infra repository.
Copy link

Choose a reason for hiding this comment

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

Suggested change
├── tools # This folder contains code sources of a Go applications for test-infra repository.
├── tools # This folder contains code sources of Go applications for the "test-infra" repository.

├── create-gcp-secrets.sh # This script downloads Secrets from the GCP storage bucket to your Prow installation.
├── install-prow.sh # This script installs Prow on your cluster.
├── provision-cluster.sh # This script creates a Kubernetes cluster.
├── remove-prow.sh # This script removes Prow from your Kubernetes cluster.
├── update-config.sh # This script updates the new configuration of the "config.yaml" file on a cluster.
├── update-jobs.sh # This script updates the new configuration of the job configurations on a cluster.
Copy link

Choose a reason for hiding this comment

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

Suggested change
├── update-jobs.sh # This script updates the new configuration of the job configurations on a cluster.
├── update-jobs.sh # This script updates the new configuration of the jobs on a cluster.

go run cmd/configuploader/main.go --kubeconfig $HOME/.kube/config --plugin-config-path {pathToPluginsYaml}
```

For details how to run commands, go to `cmd` directory.
Copy link

Choose a reason for hiding this comment

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

Suggested change
For details how to run commands, go to `cmd` directory.
For details on flags to use with the command, go to the `cmd` directory.


## Overview

This project contains Go applications for test-infra repository.
Copy link

Choose a reason for hiding this comment

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

Suggested change
This project contains Go applications for test-infra repository.
This project contains Go applications for the `test-infra` repository.

| --kubeconfig | Yes | The path to the kubeconfig file, needed for connecting to the cluster. |
| --config-path | No | The path to the `config.yaml` file. If set, the configuration will be uploaded. |
| --jobs-config-path | No | The path to the directory with job configurations. If set, the job configurations will be uploaded. |
| --plugin-config-path | No | The path to the `plugins.yaml` file. If set, the plugins configuration will be uploaded. |
Copy link

Choose a reason for hiding this comment

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

Suggested change
| --plugin-config-path | No | The path to the `plugins.yaml` file. If set, the plugins configuration will be uploaded. |
| **--plugin-config-path** | No | The path to the `plugins.yaml` file. Set it to upload plugin configurations to a cluster. |

go run cmd/configuploader/main.go --kubeconfig $HOME/.kube/config --plugin-config-path {pathToPluginsYaml}
```

## Parameters
Copy link

Choose a reason for hiding this comment

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

Suggested change
## Parameters
### Flags

@@ -2,7 +2,7 @@

This instruction provides the steps required to deploy your own Prow on a forked repository for test and development purposes.

> **NOTE:** The following instructions assume that you are signed in to the Google Cloud project with administrative rights and that you have the $GOPATH already set.
> **NOTE:** The following instructions assume that you are signed in to the Google Cloud project with administrative rights and that you have the \$GOPATH already set.
Copy link

Choose a reason for hiding this comment

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

Suggested change
> **NOTE:** The following instructions assume that you are signed in to the Google Cloud project with administrative rights and that you have the \$GOPATH already set.
> **NOTE:** The following instructions assume that you are signed in to the Google Cloud project with administrative rights and that you have the `$GOPATH` already set.

@@ -162,12 +161,18 @@ If the files are configured correctly, upload the files on a cluster.
./update-plugins.sh ../prow/plugins.yaml
```

2. Use the `update-config.sh {file_path}` script to apply jobs configuration on a cluster.
2. Use the `update-config.sh {file_path}` script to apply prow configuration on a cluster.
Copy link

Choose a reason for hiding this comment

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

Suggested change
2. Use the `update-config.sh {file_path}` script to apply prow configuration on a cluster.
2. Use the `update-config.sh {file_path}` script to apply Prow configuration on a cluster.


## Overview

This command is responsible for uploading Prow configuration.
Copy link

Choose a reason for hiding this comment

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

Suggested change
This command is responsible for uploading Prow configuration.
This command is responsible for uploading Prow configuration to a Prow cluster.

@hudymi hudymi merged commit e5521b6 into kyma-project:master Nov 16, 2018
@kyma-bot
Copy link
Contributor

@michal-hudy: Updated the job-config configmap using the following files:

  • key validation.jobs.yaml using file prow/jobs/test-infra/validation.jobs.yaml

In response to this:

Description

Changes proposed in this pull request:

  • Added a simple application that uploads configuration to Prow
  • Enabled validation of job configs

Related issue(s)

See #87

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@hudymi hudymi deleted the config-updater branch November 21, 2018 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci Issues or PRs related to CI related topics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants