From 432459ef4e8119000e8d4076d3a7c9931fc292f1 Mon Sep 17 00:00:00 2001 From: scrungus Date: Tue, 21 Feb 2023 12:20:27 +0000 Subject: [PATCH 1/4] new workflow --- .github/workflows/build-and-push-images.yml | 41 +++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/build-and-push-images.yml diff --git a/.github/workflows/build-and-push-images.yml b/.github/workflows/build-and-push-images.yml new file mode 100644 index 0000000..b1652fa --- /dev/null +++ b/.github/workflows/build-and-push-images.yml @@ -0,0 +1,41 @@ +name: Create and publish a Docker image + +on: + push: + branches: master + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file From bd961206821e43e73a63e54e435e63a9038cd893 Mon Sep 17 00:00:00 2001 From: scrungus Date: Tue, 21 Feb 2023 12:21:49 +0000 Subject: [PATCH 2/4] testing --- .github/workflows/build-and-push-images.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-push-images.yml b/.github/workflows/build-and-push-images.yml index b1652fa..5afad92 100644 --- a/.github/workflows/build-and-push-images.yml +++ b/.github/workflows/build-and-push-images.yml @@ -3,6 +3,7 @@ name: Create and publish a Docker image on: push: branches: master + pull_request: env: REGISTRY: ghcr.io From 910acbe0e2ed1e2fbdcefccfce0c10a3d7cc7c4f Mon Sep 17 00:00:00 2001 From: scrungus Date: Tue, 21 Feb 2023 15:56:29 +0000 Subject: [PATCH 3/4] changed branch --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2ca32f8..2780afa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,7 @@ RUN apt-get update && apt-get install --yes sudo python3-dev python3-pip vim git echo "rally ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/00-rally-user && \ mkdir /rally && chown -R rally:rally /rally -RUN pip install git+https://github.com/stackhpc/rally-openstack.git@feature/non-admin-creds --no-cache-dir && \ +RUN pip install git+https://github.com/stackhpc/rally-openstack.git@fix-rally --no-cache-dir && \ pip3 install pymysql psycopg2-binary --no-cache-dir COPY ./etc/motd_for_docker /etc/motd From 8c1801d4c5adaa9359a8b12ca990d4a8f9d0f671 Mon Sep 17 00:00:00 2001 From: scrungus Date: Tue, 21 Feb 2023 16:29:57 +0000 Subject: [PATCH 4/4] only push on tags/push to master --- .github/workflows/build-and-push-images.yml | 15 ++++++++++----- Dockerfile | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-push-images.yml b/.github/workflows/build-and-push-images.yml index 5afad92..54bafd5 100644 --- a/.github/workflows/build-and-push-images.yml +++ b/.github/workflows/build-and-push-images.yml @@ -2,8 +2,13 @@ name: Create and publish a Docker image on: push: - branches: master + branches: + - 'master' + tags: + - 'v*' pull_request: + branches: + - 'master' env: REGISTRY: ghcr.io @@ -21,7 +26,7 @@ jobs: uses: actions/checkout@v3 - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + uses: docker/login-action@v2 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -29,14 +34,14 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + uses: docker/metadata-action@v4 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + uses: docker/build-push-action@v4 with: context: . - push: true + push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 2780afa..2ca32f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,7 @@ RUN apt-get update && apt-get install --yes sudo python3-dev python3-pip vim git echo "rally ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/00-rally-user && \ mkdir /rally && chown -R rally:rally /rally -RUN pip install git+https://github.com/stackhpc/rally-openstack.git@fix-rally --no-cache-dir && \ +RUN pip install git+https://github.com/stackhpc/rally-openstack.git@feature/non-admin-creds --no-cache-dir && \ pip3 install pymysql psycopg2-binary --no-cache-dir COPY ./etc/motd_for_docker /etc/motd