From 23828e421b88c41e559406b13c7ac1a11a1e4caf Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 20 Nov 2020 13:35:18 -0800 Subject: [PATCH] New pipeline to publish restler docker image. #78 (#82) --- ci_build_pipelines/publish-restler.yml | 64 +++++++++++++++++++ .../stages/build/steps/restlerfullbuild.yml | 4 ++ docker/Dockerfile | 17 +++++ 3 files changed, 85 insertions(+) create mode 100644 ci_build_pipelines/publish-restler.yml create mode 100644 docker/Dockerfile diff --git a/ci_build_pipelines/publish-restler.yml b/ci_build_pipelines/publish-restler.yml new file mode 100644 index 0000000..65b5a77 --- /dev/null +++ b/ci_build_pipelines/publish-restler.yml @@ -0,0 +1,64 @@ +trigger: + batch : true + branches: + include: + - 'main' + +parameters: + - name: RestlerBuildTag + displayName: Restler Tag or Commit + default: "Tag Name" + - name: Production + displayName: Publish For Production? + default: No + values: + - Yes + - No + +variables: + - template: 'variables/version-variables.yml' + - name: version.revision + value: $[counter(variables['devRevision'], 1)] + - name: versionNumber + value: $(version.major).$(version.minor).$(version.revision) + +stages: + - template: stages/build/build.yml + + - stage: publish + jobs: + - job: PublishDockerImage + pool: + vmImage: 'ubuntu-latest' + steps: + - checkout: self + + - task: DownloadPipelineArtifact@2 + inputs: + artifact: restler-fuzzer-drop-for-docker + path: $(Build.SourcesDirectory)/artifacts/restler-fuzzer-drop + + - task: Docker@2 + displayName: 'Publish Restler Test' + condition: and(succeeded(), eq('${{parameters.Production}}', 'No')) + inputs: + buildContext: $(Build.SourcesDirectory)/artifacts/restler-fuzzer-drop + command: buildAndPush + containerRegistry: acrrestler + repository: restler + Dockerfile: $(Build.SourcesDirectory)/docker/Dockerfile + tags: | + Test-$(Build.BuildNumber) + + - task: Docker@2 + displayName: 'Publish Restler Production' + condition: and(succeeded(), eq('${{parameters.Production}}', 'Yes')) + inputs: + buildContext: $(Build.SourcesDirectory)/artifacts/restler-fuzzer-drop + command: buildAndPush + containerRegistry: RAFTProductionRegistry + repository: public/restlerfuzzer/restler + Dockerfile: $(Build.SourcesDirectory)/docker/Dockerfile + tags: | + ${{ parameters.RestlerBuildTag }} + \ No newline at end of file diff --git a/ci_build_pipelines/stages/build/steps/restlerfullbuild.yml b/ci_build_pipelines/stages/build/steps/restlerfullbuild.yml index 265ddbf..0fd77e0 100644 --- a/ci_build_pipelines/stages/build/steps/restlerfullbuild.yml +++ b/ci_build_pipelines/stages/build/steps/restlerfullbuild.yml @@ -64,3 +64,7 @@ steps: artifactName: 'restler-fuzzer-drop-$(versionNumber)' publishLocation: 'Container' + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $(Agent.BuildDirectory)/restler_drop/ + artifactName: restler-fuzzer-drop-for-docker diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..1c8b037 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,17 @@ +FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine + +COPY ./compiler /RESTler/compiler +COPY ./restler /RESTler/restler + +#Get the source code for the engine, and +#copy source code to the image +#RESTler Python dependency +RUN apk add --no-cache python3 +RUN python3 -m ensurepip +RUN pip3 install --upgrade pip +RUN pip3 install requests +RUN pip3 install requests +RUN pip3 install applicationinsights +COPY ./engine /RESTler/engine +RUN python3 -m compileall -b /RESTler/engine +COPY ./resultsAnalyzer /RESTler/resultsAnalyzer