DockerHub autobuild for a GitHub pull request - using the $DOCKER_TAG variable?docker autobuild with git private submoduleIn a Dockerfile, How to update PATH environment variable?Where should i run my grunt build step when building my docker image for staging and production environments?Writing Dockerfile for Dockerhub Automated buildsDocker on RHEL 7 in AWS can’t pull imagesDocker workflow for automated builds on Github-DockerhubDocker daemon using several registriesHow can I make Jenkins aware of Dockerhub's webhook?Can't Access Private MySQL Docker Image From Gitlab CISingle dockerfiles GitHub repository + Docker Hub automated builds

Hail hit my roof. Do I need to replace it?

How to convert diagonal matrix to rectangular matrix

What was this character's plan?

An integral that needs subtitution to be solved.

What happens to unproductive professors?

Moving millions of files to a different directory with specfic name patterns

How to evaluate the performance of open source solver?

Party going through airport security at separate times?

Why did Dumbledore ignore this line?

Restrict Access to internet for all MAC except listed on LINKSYS Wireless-N ADSL2+ Modem Router

Transpose matrices and vectors - rules

Finding overlapping polygons in two shapefiles and deleting them in R?

This LM317 diagram doesn't make any sense to me

How many tone holes are there actually in different orchestral woodwind instruments?

Did the Ottoman empire suppress the printing press?

Non-Chromatic Orchestral Instruments?

Swapping "Good" and "Bad"

User Vs. Connected App

Estimates on number of topologies on a finite set

Why is a mixture of two normally distributed variables only bimodal if their means differ by at least two times the common standard deviation?

Password Hashing Security Using Scrypt & Argon2

What is the problem here?(all integers are irrational proof...i think so)

How was the Shuttle loaded and unloaded from its carrier aircraft?

Users forgetting to regenerate PDF before sending it



DockerHub autobuild for a GitHub pull request - using the $DOCKER_TAG variable?


docker autobuild with git private submoduleIn a Dockerfile, How to update PATH environment variable?Where should i run my grunt build step when building my docker image for staging and production environments?Writing Dockerfile for Dockerhub Automated buildsDocker on RHEL 7 in AWS can’t pull imagesDocker workflow for automated builds on Github-DockerhubDocker daemon using several registriesHow can I make Jenkins aware of Dockerhub's webhook?Can't Access Private MySQL Docker Image From Gitlab CISingle dockerfiles GitHub repository + Docker Hub automated builds






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I have a project with DockerHub autobuilds running for each branch of the project. These builds are running nicely.



I would like to extend this autobuild configuration to build images for selected pull requests for these branches.



enter image description here



The following documentation indicates that a variable named DOCKER_TAG should be available in a DockerHub autobuild.



https://docs.docker.com/docker-hub/builds/advanced/#environment-variables-for-building-and-testing



I want to configure my auto build in the following manner.



If I attempt to build a tag named "pr1234" then my build will overlay the code from PR #1234 before running the build.



# Assign the env variable DOCKER_TAG to an arg of the same name
ARG DOCKER_TAG=$DOCKER_TAG

...

# if DOCKER_TAG is in the format prNNNN then merge code for that PR on top of the current branch
RUN PRNUM=`echo $DOCKER_TAG| egrep "^pr([0-9]+)$" | sed -e s/pr//` &&
if [ -n "$PRNUM" ];
then echo "Merging $PRNUM";
curl -o /tmp/pr.patch -L https://github.com/DSpace/DSpace/pull/$PRNUM.diff;
git apply /tmp/pr.patch;
fi


If I run my build locally, I am able to set this variable and my docker build runs as I would like.



docker build -t dspace/dspace:pr1234 -f Dockerfile.jdk8-test --build-arg DOCKER_TAG=pr1234 .


When I attempt to run this from Dockerhub, the DOCKER_TAG variable appears to be blank, so I presume that DOCKER_TAG is not being set as I expected.



Can you suggest a way to access this variable or to accomplish an automated build for selected PR's?










share|improve this question




























    1















    I have a project with DockerHub autobuilds running for each branch of the project. These builds are running nicely.



    I would like to extend this autobuild configuration to build images for selected pull requests for these branches.



    enter image description here



    The following documentation indicates that a variable named DOCKER_TAG should be available in a DockerHub autobuild.



    https://docs.docker.com/docker-hub/builds/advanced/#environment-variables-for-building-and-testing



    I want to configure my auto build in the following manner.



    If I attempt to build a tag named "pr1234" then my build will overlay the code from PR #1234 before running the build.



    # Assign the env variable DOCKER_TAG to an arg of the same name
    ARG DOCKER_TAG=$DOCKER_TAG

    ...

    # if DOCKER_TAG is in the format prNNNN then merge code for that PR on top of the current branch
    RUN PRNUM=`echo $DOCKER_TAG| egrep "^pr([0-9]+)$" | sed -e s/pr//` &&
    if [ -n "$PRNUM" ];
    then echo "Merging $PRNUM";
    curl -o /tmp/pr.patch -L https://github.com/DSpace/DSpace/pull/$PRNUM.diff;
    git apply /tmp/pr.patch;
    fi


    If I run my build locally, I am able to set this variable and my docker build runs as I would like.



    docker build -t dspace/dspace:pr1234 -f Dockerfile.jdk8-test --build-arg DOCKER_TAG=pr1234 .


    When I attempt to run this from Dockerhub, the DOCKER_TAG variable appears to be blank, so I presume that DOCKER_TAG is not being set as I expected.



    Can you suggest a way to access this variable or to accomplish an automated build for selected PR's?










    share|improve this question
























      1












      1








      1


      1






      I have a project with DockerHub autobuilds running for each branch of the project. These builds are running nicely.



      I would like to extend this autobuild configuration to build images for selected pull requests for these branches.



      enter image description here



      The following documentation indicates that a variable named DOCKER_TAG should be available in a DockerHub autobuild.



      https://docs.docker.com/docker-hub/builds/advanced/#environment-variables-for-building-and-testing



      I want to configure my auto build in the following manner.



      If I attempt to build a tag named "pr1234" then my build will overlay the code from PR #1234 before running the build.



      # Assign the env variable DOCKER_TAG to an arg of the same name
      ARG DOCKER_TAG=$DOCKER_TAG

      ...

      # if DOCKER_TAG is in the format prNNNN then merge code for that PR on top of the current branch
      RUN PRNUM=`echo $DOCKER_TAG| egrep "^pr([0-9]+)$" | sed -e s/pr//` &&
      if [ -n "$PRNUM" ];
      then echo "Merging $PRNUM";
      curl -o /tmp/pr.patch -L https://github.com/DSpace/DSpace/pull/$PRNUM.diff;
      git apply /tmp/pr.patch;
      fi


      If I run my build locally, I am able to set this variable and my docker build runs as I would like.



      docker build -t dspace/dspace:pr1234 -f Dockerfile.jdk8-test --build-arg DOCKER_TAG=pr1234 .


      When I attempt to run this from Dockerhub, the DOCKER_TAG variable appears to be blank, so I presume that DOCKER_TAG is not being set as I expected.



      Can you suggest a way to access this variable or to accomplish an automated build for selected PR's?










      share|improve this question














      I have a project with DockerHub autobuilds running for each branch of the project. These builds are running nicely.



      I would like to extend this autobuild configuration to build images for selected pull requests for these branches.



      enter image description here



      The following documentation indicates that a variable named DOCKER_TAG should be available in a DockerHub autobuild.



      https://docs.docker.com/docker-hub/builds/advanced/#environment-variables-for-building-and-testing



      I want to configure my auto build in the following manner.



      If I attempt to build a tag named "pr1234" then my build will overlay the code from PR #1234 before running the build.



      # Assign the env variable DOCKER_TAG to an arg of the same name
      ARG DOCKER_TAG=$DOCKER_TAG

      ...

      # if DOCKER_TAG is in the format prNNNN then merge code for that PR on top of the current branch
      RUN PRNUM=`echo $DOCKER_TAG| egrep "^pr([0-9]+)$" | sed -e s/pr//` &&
      if [ -n "$PRNUM" ];
      then echo "Merging $PRNUM";
      curl -o /tmp/pr.patch -L https://github.com/DSpace/DSpace/pull/$PRNUM.diff;
      git apply /tmp/pr.patch;
      fi


      If I run my build locally, I am able to set this variable and my docker build runs as I would like.



      docker build -t dspace/dspace:pr1234 -f Dockerfile.jdk8-test --build-arg DOCKER_TAG=pr1234 .


      When I attempt to run this from Dockerhub, the DOCKER_TAG variable appears to be blank, so I presume that DOCKER_TAG is not being set as I expected.



      Can you suggest a way to access this variable or to accomplish an automated build for selected PR's?







      docker dockerhub






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 25 at 23:18









      terrywbterrywb

      2,6151 gold badge10 silver badges30 bronze badges




      2,6151 gold badge10 silver badges30 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          2














          I found a solution that seems to work. I created a build hook named hooks/build and pass the variable explicitly.



          #!/bin/bash
          docker build --build-arg DOCKER_TAG=$DOCKER_TAG -f $DOCKERFILE_PATH -t $IMAGE_NAME .


          See https://docs.docker.com/docker-hub/builds/advanced/#custom-build-phase-hooks






          share|improve this answer

























          • Thanks for your answer. That helps me out the issue.

            – Bowen
            May 11 at 10:39










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55347752%2fdockerhub-autobuild-for-a-github-pull-request-using-the-docker-tag-variable%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          I found a solution that seems to work. I created a build hook named hooks/build and pass the variable explicitly.



          #!/bin/bash
          docker build --build-arg DOCKER_TAG=$DOCKER_TAG -f $DOCKERFILE_PATH -t $IMAGE_NAME .


          See https://docs.docker.com/docker-hub/builds/advanced/#custom-build-phase-hooks






          share|improve this answer

























          • Thanks for your answer. That helps me out the issue.

            – Bowen
            May 11 at 10:39















          2














          I found a solution that seems to work. I created a build hook named hooks/build and pass the variable explicitly.



          #!/bin/bash
          docker build --build-arg DOCKER_TAG=$DOCKER_TAG -f $DOCKERFILE_PATH -t $IMAGE_NAME .


          See https://docs.docker.com/docker-hub/builds/advanced/#custom-build-phase-hooks






          share|improve this answer

























          • Thanks for your answer. That helps me out the issue.

            – Bowen
            May 11 at 10:39













          2












          2








          2







          I found a solution that seems to work. I created a build hook named hooks/build and pass the variable explicitly.



          #!/bin/bash
          docker build --build-arg DOCKER_TAG=$DOCKER_TAG -f $DOCKERFILE_PATH -t $IMAGE_NAME .


          See https://docs.docker.com/docker-hub/builds/advanced/#custom-build-phase-hooks






          share|improve this answer















          I found a solution that seems to work. I created a build hook named hooks/build and pass the variable explicitly.



          #!/bin/bash
          docker build --build-arg DOCKER_TAG=$DOCKER_TAG -f $DOCKERFILE_PATH -t $IMAGE_NAME .


          See https://docs.docker.com/docker-hub/builds/advanced/#custom-build-phase-hooks







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 26 at 14:19

























          answered Mar 26 at 4:38









          terrywbterrywb

          2,6151 gold badge10 silver badges30 bronze badges




          2,6151 gold badge10 silver badges30 bronze badges












          • Thanks for your answer. That helps me out the issue.

            – Bowen
            May 11 at 10:39

















          • Thanks for your answer. That helps me out the issue.

            – Bowen
            May 11 at 10:39
















          Thanks for your answer. That helps me out the issue.

          – Bowen
          May 11 at 10:39





          Thanks for your answer. That helps me out the issue.

          – Bowen
          May 11 at 10:39








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55347752%2fdockerhub-autobuild-for-a-github-pull-request-using-the-docker-tag-variable%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현