package resource

import (
	"context"

	"github.com/concourse/concourse/atc"
	"github.com/concourse/concourse/atc/runtime"
)

func (resource *resource) Check(
	ctx context.Context,
	spec runtime.ProcessSpec,
	runnable runtime.Runnable) ([]atc.Version, error) {
	var versions []atc.Version

	err := runnable.RunScript(
		ctx,
		spec.Path,
		nil,
		resource,
		&versions,
		nil,
		false,
	)
	if err != nil {
		return nil, err
	}

	return versions, nil
}

package resource

import (
	"context"
	"github.com/concourse/concourse/atc"
	"github.com/concourse/concourse/atc/runtime"
)

type checkRequest struct {
	Source  atc.Source  `json:"source"`
	Version atc.Version `json:"version"`
}

func (resource *resource) Check(
	ctx context.Context,
	spec runtime.ProcessSpec,
	runnable runtime.Runnable) ([]atc.Version, error) {
	var versions []atc.Version

	err := runnable.RunScript(
		ctx,
		spec.Path,
		nil,
		checkRequest{resource.source, resource.version},
		&versions,
		nil,
		false,
	)
	if err != nil {
		return nil, err
	}

	return versions, nil
}

Fix broken check resource - run script was being passed a resource instead of serializable json
Fix broken check resource
- run script was being passed a resource instead of serializable json

Signed-off-by: Krishna Mannem <70f8bf4e42dd699c2822d738a7ab22d45b22b08a@pivotal.io>
Signed-off-by: Sameer Vohra <9dd3a30774efbd15e2401a4c8ee8d5219d46192f@gmail.com>
